• Michael Poppers (8/3/2010)


    The difference, Oleg, is that the 1st argument to ROUND() is a NUMERIC. I would nevertheless not want T-SQL's behavior to change :-).

    This is true, but who said that int is not numeric? Well, I will actually switch from numeric wordy to decimal at this point. I understand that they are synonyms and numeric is ANSI standard, but it just smells like Oracle to me, so I prefer decimal instead. Int can be considered as decimal(10, 0). From BOL:

    For example, int data type can hold 10 digits, is stored in 4 bytes, and does not accept decimal points. The int data type has a precision of 10, a length of 4, and a scale of 0.

    So, both statements below:

    select round(5, 1);

    select round(cast(5 as decimal(10,0)), 1);

    are pretty similar, both print 5 in the results window. 🙂

    Oleg