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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Decimal Places

Status
Not open for further replies.

MsMope

IS-IT--Management
Joined
Sep 3, 2003
Messages
83
Location
US
Good Morning,
I have a table that has a column "price" this column needs to be whole number only ( integers) currently, there are some values that have decimals. How do I remove these?
 
Depends on whether you want to remove them entirely or round them to the next highest or lowest value.
 
I want to round up to the next highest value, but I do not want the decimal places in the table at all...

Thanks for your help
 
Try this:
Code:
SELECT CAST((ROUND(price,0,1) + 1) as int)
FROM table


~Brian
 
update table
set price = convert(int,round(price,0))


then update the table column to an int...

dlc
 
If you always want to round up, neither of those methods will work.

Update table
set field = Round(Field, 0, 1) +1
where field <> Round(Field, 0, 1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top