Mar 6, 2006 #1 PrgrmsAll Programmer Apr 8, 2003 180 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 Oct 1, 2005 5,575 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 #4 SQLDenis Programmer Oct 1, 2005 5,575 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 Mar 14, 2005 2,924 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 Apr 8, 2003 180 US Thanks to all for your great suggestions. Upvote 0 Downvote