Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Simple Rounding question

Author  Topic 

miked1978
Starting Member

25 Posts

Posted - 2008-09-24 : 09:36:11
I just need to round some of my fields to no decimal places. The data types are char.

Here is my final select statement and I need to round the last 4 fields. Please help

select tbAhdBhdstep3.*, tbAhdBhdstep3a.CsoAhead, tbAhdBhdstep3a.CsoBehind, tbAhdBhdstep3a.CsoSVc, tbAhdBhdstep3a.CsoCVc
into tbAhdBhdstep4
from tbAhdBhdstep3, tbAhdBhdstep3a
where tbAhdBhdstep3.hull = tbAhdBhdstep3a.hull and tbAhdBhdstep3.Div = tbAhdBhdstep3a.Div

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-24 : 10:07:36
Use cast(col as numeric(12,0))

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

miked1978
Starting Member

25 Posts

Posted - 2008-09-24 : 10:55:34
quote:
Originally posted by madhivanan

Use cast(col as numeric(12,0))

Madhivanan

Failing to plan is Planning to fail


Do I use an update statement?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-24 : 11:06:58
quote:
Originally posted by miked1978

quote:
Originally posted by madhivanan

Use cast(col as numeric(12,0))

Madhivanan

Failing to plan is Planning to fail


Do I use an update statement?


only if you want to keep rounded values in db. other wise you can round it always during retrieval in select query
Go to Top of Page
   

- Advertisement -