David Svedarsky
asked on
Round column numbers to nearest dollar in Sql Server 2005
I need a method to Round a column's numbers to the nearest dollar in Sql Server 2005.
Any numbers with cents (123.20) the .20 breaks the table.
Thanks for your help!
Any numbers with cents (123.20) the .20 breaks the table.
Thanks for your help!
ASKER
How would I structure that query?
The table is: tblPlumbingListBidDetail
The column name is: UnitPrice
I basically only work with the application that is attached to the database....
The table is: tblPlumbingListBidDetail
The column name is: UnitPrice
I basically only work with the application that is attached to the database....
Like this:
SELECT ROUND(UnitPrice, 0)
FROM tblPlumbingListBidDetail
ASKER
It didn't work - probably because I have NULL values in the column?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use ISNULL or COALESCE to provide zero instead of null, like this:
SELECT ROUND(ISNULL(UnitPrice,0), 0), Field1, Field2, Field3
FROM tblPlumbingListBidDetail
SELECT COALESCE(ISNULL(UnitPrice,0), 0), Field1, Field2, Field3
FROM tblPlumbingListBidDetail
ASKER
Thanks!
This SQL guide is the only reference book that is on my desk. Whenever I have an SQL question, I look there first.