• Beside the type, I would add two more points.

    If you want to be absolutely sure that you will retain the precision in your calculatins:

    • use decimal(25,13) in internal calculation for ALL partcipants

    • do operatins that enlarge the result first, and those that make result smaller do last. Eg do multiplicatins and additions first, and postpone substraction and divide operations to the end.

    • if you have more than one operation, each operation result must be casted to decimal(25,13). Ugly, but that ensure you have no loss of precision.

    For example, if you have three decimal(25,13) variables, instead of:

    @x/@y*@z

    Rewrite like this:

    Convert(decimal(25,13), @x*@z)/@y

    Notice different order of operations and cast of result even all the operans are decimal(25,13).

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