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
 General SQL Server Forums
 New to SQL Server Programming
 Truncating Decimals w/ diff data types...

Author  Topic 

SQLSoaker
Posting Yak Master

169 Posts

Posted - 2008-12-31 : 10:38:35
Hello,

I am trying to get rid of the decimal points for two different data types:

1) numeric(28,12)
2) nvarchar(10)

Need to have this: 120.00000000 into this: 120.00

I know you have to convert or cast the types into different one's but how???

Thank you in advance.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-31 : 10:47:29
Use ROUND and then CAST to DECIMAL(10, 2) or similar.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-31 : 12:38:38
Why are you using nvarchar(10) to store number data?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

SQLSoaker
Posting Yak Master

169 Posts

Posted - 2008-12-31 : 15:50:08
Thank you Peso, worked!
Go to Top of Page
   

- Advertisement -