Good! Now that you know how to subtract and divide in T-SQL, we'll talk about some other numeric functions. One of them is
ROUND(), which looks like this:
This function will round the number (the first parameter) to the nearest numeric value, using the precision specified by the second parameter. Its default is standard mathematical rounding: anything equal to or greater than
0.5 will be rounded up to the next whole number.
Let's look at
ROUND() in action:
ROUND(AccountBalance, 0) AS Round
WHERE Id = 1;
The above query will take the
AccountBalance of the character with
Id = 1 (the
899.34) and round it to the nearest integer (
899.00). Remember that
ROUND() won't change the type of the value returned.