If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > modelling question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-06, 12:12
dpua dpua is offline
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old 01-14-06, 21:28
certus certus is offline
Registered User
 
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.
__________________
visit: relationary
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On