Reputation: 1554
I tried with
select ROUND(1235.53)
--(It can contain "n" digit of scale)
But I got this error:
The round function requires 2 to 3 arguments.
I am not sure what is the use of other parameters.
Upvotes: 26
Views: 149646
Reputation: 21
Here is another approach that just formats the result into the desired format:
SELECT FORMAT(ROUND(1235.53,0), 'N0')
'N' stands for numerical format and the digit behind it controls the number of decimal points.
Upvotes: 1
Reputation: 14699
Better to use CAST INT/CEILING/FLOOR:
SELECT CEILING(1235.53)
SELECT FLOOR(1235.53)
SELECT CAST(1235.53 AS INT)
CEILING: Gives you the upper bound integer value
FLOOR: Gives you the lower bound integer value
Upvotes: 36
Reputation: 82010
Set decimals to zero
select cast(ROUND(1235.53,0) as int) Returns 1236
select cast(1235.53 as int) Returns 1235
Upvotes: 43