Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Round Number to Highest 0.25 2

Status
Not open for further replies.

nutrotek

Technical User
Aug 10, 2006
8
US
How do you round a decimal value in SQL to the highest 0.25? I'm trying to use the CEILING() function from Excel. In Excel the function CEILING(13.05,0.25)=13.25. In SQL SELECT CEILING(13.05)=14. In SQL, ceiling only has one arguement. I'm using SQL2000, if that matters. Thanks for your help.
 
Multiply by 4, take the ceiling, and then divide by 4.

Code:
Declare @Val Decimal(10,2)

Set @Val = 13.12

Select Ceiling(@Val * 4) / 4.0


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks George... just what I was looking for. Star for you.

zemp
 
zemp,

I'm glad I was able to help. [smile] Cheers for doing a search before posting a new question. I wish more people did that!

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top