Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error Converting Data Type Varchar To Numeric When Updating Field

Posted on 2009-07-14
3
Medium Priority
?
249 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

824 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