Home Forums SQL Server 2008 T-SQL (SS2K8) Using Results from one column to calculate another column RE: Using Results from one column to calculate another column

  • If you make one result as persistent calculated column, and other as non-persistent calculated column, than maybe.

    If you want to be sure, instead of calculated fields use trigger to calculate and store both values, but that may not be as performant.

    Other idea is to make result1 as persistent calculated field and then view on top of that table that has calculation for result2.

    Or, do it completely non-persistent, with view that has nested subquery or cross apply or cte that would guarantee the order of calculations and reusage of result from previous level. My favourite would be completely persistent solution, or cross apply from non-persistent world, depending on read-write ratio of that table and cost of formula calculation.

    Hth

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths