Mar 6, 2006 #1 PrgrmsAll Programmer Joined Apr 8, 2003 Messages 180 Location US I need to have the following SQL round the result to the nearest integer: SELECT v_MASTER_FACTOR.FACTOR * CAST(COUNT(Parts.PartsID) AS decimal(9)) AS intResult Currently it is returning 0.9999999999, I need this to show 1, etc. Thanks in advance.
I need to have the following SQL round the result to the nearest integer: SELECT v_MASTER_FACTOR.FACTOR * CAST(COUNT(Parts.PartsID) AS decimal(9)) AS intResult Currently it is returning 0.9999999999, I need this to show 1, etc. Thanks in advance.
Mar 6, 2006 #2 SQLDenis Programmer Joined Oct 1, 2005 Messages 5,575 Location US use ceiling select ceiling(0.9999999999) Denis The SQL Menace SQL blog:http://sqlservercode.blogspot.com/ Personal Blog:http://otherthingsnow.blogspot.com/ Upvote 0 Downvote
use ceiling select ceiling(0.9999999999) Denis The SQL Menace SQL blog:http://sqlservercode.blogspot.com/ Personal Blog:http://otherthingsnow.blogspot.com/
Mar 6, 2006 #3 Juice05 Programmer Joined Dec 4, 2001 Messages 247 Location US Round(Value,1,0) Upvote 0 Downvote
Mar 6, 2006 #4 SQLDenis Programmer Joined Oct 1, 2005 Messages 5,575 Location US scrap that ceiling will always 'round' up and floor will always 'round' down use round instead like suggested by Juice05 Denis The SQL Menace SQL blog:http://sqlservercode.blogspot.com/ Personal Blog:http://otherthingsnow.blogspot.com/ Upvote 0 Downvote
scrap that ceiling will always 'round' up and floor will always 'round' down use round instead like suggested by Juice05 Denis The SQL Menace SQL blog:http://sqlservercode.blogspot.com/ Personal Blog:http://otherthingsnow.blogspot.com/
Mar 6, 2006 #5 earthandfire Programmer Joined Mar 14, 2005 Messages 2,924 Location GB Or, of course you could use: select parsename(Value + 0.5, 2) Hope this helps Upvote 0 Downvote
Mar 6, 2006 Thread starter #6 PrgrmsAll Programmer Joined Apr 8, 2003 Messages 180 Location US Thanks to all for your great suggestions. Upvote 0 Downvote