Solved

Error Converting Data Type Varchar To Numeric When Updating Field

Posted on 2009-07-14
3
241 Views
Last Modified: 2012-05-07
Hey guys, I imported pricing into my table and some were a NULL (empty) value and when I try to update them to '0.0000' I get the following 'Error converting data type varchar to numeric.'

Select * from MyTable
Where Price = ''
also returns the error 'Error converting data type varchar to numeric.'

Is there any way I can update the db, or will I need to change my master import file not to contain null values?

Cheers

0
Comment
Question by:Girac
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24854149
Select * from MyTable
Where Price is null

OR

Select * from MyTable
Where ISNUMERIC(Price) = 0
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24854203
update urTable
SET NumericColumn = 0
WHERE NumericCOlumn is null or ISNUMERIC(NumericColumn) =  0
0
 

Author Comment

by:Girac
ID: 24854280
Once I seen the 'Where ISNUMERIC(Price) = 0 ' I was able to update.

Cheers,
G
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

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 needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

810 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