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
 error to convert nvarchar to numeric

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-08-15 : 03:18:04
im hitting error to convert nvarchar to numeric.

my data as below:

2721.000000000000

how can i convert to be just 2721?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-08-15 : 05:32:35
[code]convert(decimal(10), '2721.000000000000')[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2013-08-15 : 05:38:34
what if there's percentage behind? can this convert still be use?

2721.000000000000 %
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-08-15 : 07:19:22
[code]convert(decimal(10), replace('2721.000000000000 %', '%', '')[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -