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
 Help with update statement

Author  Topic 

aharvestofhealth
Yak Posting Veteran

52 Posts

Posted - 2011-07-28 : 16:39:43
I'm a newbee, and am trying to run the following:

update im_item
set ALT_2_NUMER = 'NULL'
where ALT_2_UNIT is null

It keeps returning this error:

Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.

What am I doing wrong?

DeepGround
Yak Posting Veteran

73 Posts

Posted - 2011-07-28 : 16:50:38
try set ALT_2_NUMBER = NULL

single quotes takes it as a string value.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-07-28 : 16:50:39
update im_item
set ALT_2_NUMER = NULL
where ALT_2_UNIT is null

Go to Top of Page

SalasJ
Starting Member

15 Posts

Posted - 2011-07-28 : 16:54:54
Is "im_item" name of a table?

Try:

UPDATE im_item
set ALT_2_NUMER='NULL'
where ALT_2_UNIT='null'
Go to Top of Page

aharvestofhealth
Yak Posting Veteran

52 Posts

Posted - 2011-07-28 : 16:57:48
Thanks guys! Setting ALT_2_NUMBER = NULL did the trick.
Go to Top of Page
   

- Advertisement -