Solved

Error converting data type nvarchar to numeric.

Posted on 2008-10-21
3
959 Views
Last Modified: 2008-10-21
Trying to update a MONEY col with values from a nvarchar(20)
I get the error  Error converting data type nvarchar to numeric.

How do I do this.. the data in the format  "123.50"
0
Comment
Question by:JElster
  • 2
3 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 22768310
use this to convert the field
cast(NvarcharField as money)
0
 
LVL 1

Author Comment

by:JElster
ID: 22768931
Cannot convert a char value to money. The char value has incorrect syntax.


select Cast(commsamt as money)  from Commissions

Commsamt is nvarchar 20 " 1243.54"
0
 
LVL 16

Accepted Solution

by:
brad2575 earned 50 total points
ID: 22768968
try

cast(cast(NvarcharField as decimal(20, 2)) as money)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IF SQL Query 12 29
T-SQL Query - Group By Year 3 32
Need some alteration to below mention query 2 13
mysql vs miscrosoft sql server 6 21
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question