Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    4

    modelling question

    Hi all,

    I need to develop some tables in SQL server to store formulas. These formulas can be of varying complexity. Some might take the form:

    1 + 2 (ordinal1, ordinal2, operator '+')

    Others might take a more involved form:
    (calculation_from_a_field_in_another_table, random_ordinal, +) / (34 *2)

    And so on and so forth.

    The key point is that formulas can contain 1...n expressions and also a given term may be an ordinal that the user inputs, or it could be a reference to a pre-existing calculated value.

    I thought of:
    term_id,
    term_1 (NULL),
    term_2 (NULL)
    term_id_1 (NULL),
    term_id_2 (NULL),
    operator

    But you could end up with something hideously recursive.

    I would appreciate hearing from anyone who has modelled this sort of thing in their database and how best to do it from the point of view of retrieving the information quickly and efficiently.

    Thanks.

  2. #2
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    You will have to go for the hideously recursive option.

    My only suggestion is to add a "nesting level" attribute.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •