Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Dear All,i Just want to round of near by zerolike if it is 0.3 then 0.5 if it is 0.8 then 1.0if it's 0.2 then 0How can i do this please help meRegardsKrishnakuamr.C
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2006-10-03 : 04:54:55
[code]round(val / 5, 1) * 5[/code]KH
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2006-10-03 : 05:00:41
-- testing script
declare @table table( val decimal(10,2))-- create datainsert into @table select NUMBER * 0.1from F_TABLE_NUMBER_RANGE(1,20)select *, convert(decimal(10,2), round(val / 5, 1) * 5)from @table
KH
ditch
Master Smack Fu Yak Hacker
1466 Posts
Posted - 2006-10-03 : 05:10:20
Very Nice!!!!Duane.
CSK
Constraint Violating Yak Guru
489 Posts
Posted - 2006-10-03 : 06:26:05
Thank u very much khtan It's working
harshal_in
Aged Yak Warrior
633 Posts
Posted - 2006-11-10 : 05:28:07
quote:Originally posted by khtan
round(val / 5, 1) * 5
KH
Thanks khtan!! I was looking for exactly the same thing.-Harshal.