November 16, 2015 at 11:37 am
How can i round off decimal number. E.g if i have 7.9---i need to round it off to 8, if i have 7.4---i need to round it off to 7...i tried round, ceiling.. but nothing got worked... please suggest
November 16, 2015 at 11:46 am
sqlinterset (11/16/2015)
How can i round off decimal number. E.g if i have 7.9---i need to round it off to 8, if i have 7.4---i need to round it off to 7...i tried round, ceiling.. but nothing got worked... please suggest
If you tried ROUND and it isn't working, how isn't it working? You have given us nothing to work with to even to begin to help you.
How about posting an actual question with DDL, sample data, and expected results.
November 16, 2015 at 11:47 am
select ROUND(7.9, 0) , ROUND(7.4, 0)
Works for me...
November 16, 2015 at 11:53 am
sqlinterset (11/16/2015)
How can i round off decimal number. E.g if i have 7.9---i need to round it off to 8, if i have 7.4---i need to round it off to 7...i tried round, ceiling.. but nothing got worked... please suggest
The subject of this thread refers to rounding dates, but your examples are numbers. You're also using numeric functions, which don't work on dates.
If you're trying to round numbers (your sample data), the ROUND function is the right option.
If you're trying to round dates (your subject) then see Lynn's article at http://qa.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/ for how to manipulate dates using built-in date functions.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply