Solved

Error Converting Data Type Varchar To Numeric When Updating Field

Posted on 2009-07-14
3
240 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
Comment Utility
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
Comment Utility
update urTable
SET NumericColumn = 0
WHERE NumericCOlumn is null or ISNUMERIC(NumericColumn) =  0
0
 

Author Comment

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

Cheers,
G
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now