Friday, August 03, 2007

SQL Round To Quarter

This is a reminder to myself how to round to the nearest fraction, in this case a quarter.
Next time I won't spend 15 minutes trying to recall the rounding formula. I'll just look it up here.

DECLARE @target smallmoney
SET @target = 597.80


--round to quarter hour
SELECT ROUND( @Target/25.0, 2) * 25

-- Result = 597.75

1 Comments:

At 1:15 PM, Blogger Jeff said...

Elliott,
I ran across your blog and enjoyed reading some of it and catching up with your family a bit. If you like, take a look at mine http://jefben.spaces.live.com/ and say hi.

 

Post a Comment

<< Home