Rounding in SQL Server

  • I am trying to sum two numbers and round the result but SQL Server does not appear to like the function of ROUND. Can someone tell me the syntax for this function.

    Thanks

  • Try SELECT Round(12345.6789,2). This should return 12345.6800. Note that ROUND doesn't actually modify the precision of the result. If the second argument is negative, it is interpreted as a number of digits to the left of the decimal point to round to... Thus SELECT Round(12345.6789,-1) will return 12350.0000 and SELECT Round(12345.6789,0) will return 12346.0000. If you need to truncate precision to an integer, try SELECT Floor(Round(12345.6789,0)). Search Books Online for Round for more info.

    HTH,

    -SJTerrill

    Edited by - TheWildHun on 11/07/2003 1:03:01 PM

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

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