Calculated Columns- Best standards

  • What would be the best standards practised, and things to remember, on designing/using calculated columns in SQL Server - to store 'in the moment' data in each row.

    There will be a table where I need to store several columns of financial data that needs to be computed and stored for each row.

    Thanks

    Dan

  • One "best practice" is to make sure the calculated column results in a "Determinant" result so that it can be indexed if you need it to be.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff

    Can you please give an example of Determinant values in these columns.

    For example, one of the columns values would be something like

    (columnA-columnB)/ColumnC =

    1043.2250

    98765.2750

    556.3250

    11432.0950

    etc (there is no predictability).

    Thanks

    Dan

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply