engineroom
asked on
MS Sql Server - Rounding a number UP or Down
Hey all, if i have a number,...
5.370023489080
How do i get it to round down? or maybe even cutting off the .370023489080
Thanx all
5.370023489080
How do i get it to round down? or maybe even cutting off the .370023489080
Thanx all
2 decimal points
select cast(5.370023489080 as decimal(18,2))
0 decimal points
select cast(5.370023489080 as decimal(18,0))
select cast(5.370023489080 as decimal(18,2))
0 decimal points
select cast(5.370023489080 as decimal(18,0))
Cast the number as an INT:
DECLARE @Test REAL
SET @Test = 5.370023489080
SELECT @Test
SELECT CAST(@Test AS INT)
DECLARE @Test REAL
SET @Test = 5.370023489080
SELECT @Test
SELECT CAST(@Test AS INT)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The first answer on this thread that suggested floor and ceiling wasn't detailed enough?
ASKER
Sorry mastoo. As I really don't know the functions of SQL, the example provided by p_ramprathap really gave me a solid understanding of what i needed to do.
or use Floor or Ceiling functions to go up or down.