Easy one . . CAST Syntax question

  • I inherited a report that contains:

    CAST(D.Duty_Rate as decimal(22,8))

    My boss wants to know what the 22,8 mean.  The 8 is decimal places, I think, but what does the 22 represent and I can't find the list of option for that variable . . anyone have a link to the other options?

    thanks

    Jeff

  • Yep, the 22 is the total number of digits, the 8 is how many of those will be to the right of the decimal.  For a decimal 22, 8 would support up to say 99999999999999.99999999 or -99999999999999.99999999

  • ZZartin - Wednesday, April 11, 2018 12:34 PM

    Yep, the 22 is the total number of digits, the 8 is how many of those will be to the right of the decimal.  For a decimal 22, 8 would support up to say 99999999999999.99999999 or -99999999999999.99999999

    Thus the range of values is from 1 shy of 100 TRILLION to 1 more than negative 100 TRILLION, and going out to 1 part in 100 million across that entire range, giving a grand total of just shy of 200 QUINTILLION distinct values.   If that matters...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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