user1141584
user1141584

Reputation: 619

Math in SQL Server 2008 : rounding and truncating

I m looking for basic SQL query in SQL Server 2008

number   Result 
-----    ------
 0.38     0        (As it is less than 0.5)
 2.66     3        (As it is more than 2.5)
 3.8      4        (As it is more than 3.5)
 11.97    12       (As it is more than 11.50)

I'm not getting how to get it fix for using trunc, floor and other such method

Any help would be helpful.

Thanks !!!!

Upvotes: 0

Views: 139

Answers (1)

mongotop
mongotop

Reputation: 5774

I think you want something similar to this:

SELECT number, ROUND(number,0) as Result FROM Table_name

check this SQL ROUND() Function and This for more info.

Upvotes: 1

Related Questions