all groups > sql server programming > december 2003 >
You're in the

sql server programming

group:

Update SET where NULL


Update SET where NULL Russ Franklin
12/30/2003 11:25:10 PM
sql server programming: Hello,

How do I set the column of a table so that where it
equals null it gets populated with a certain value.

What I have tried is:

update HAIRCUT
set HAIRCUTCD = '001'
where HAIRCUTCD = NULL

and

update pipe_pipeNo
set ContractId = '001'
where ContractId = 'NULL'

and

update HAIRCUT
set HAIRCUTCD = '001'
where HAIRCUTCD = ''

Neither of which has worked. I receive the following: (0
row(s) affected)

The table currently has 12,000 rows where HAIRCUTCD is
NULL.

Thanks,
Russ
Re: Update SET where NULL Russ Franklin
12/31/2003 2:32:03 AM
Thanks Uri, Vinod & David.

Works like a charm.

Russ.

[quoted text, click to view]
Re: Update SET where NULL David Portas
12/31/2003 7:44:40 AM
UPDATE TableName
SET ColumnName = '001'
WHERE ColumnName IS NULL

--
David Portas
------------
Please reply only to the newsgroup
--

Re: Update SET where NULL Uri Dimant
12/31/2003 9:36:04 AM
Russ
Try use WHERE col IS NULL



[quoted text, click to view]

Re: Update SET where NULL Vinodk
12/31/2003 1:40:59 PM
NULL cannot be equated to a NULL value. Hence use the IS NULL expression in
the where clause.

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp


[quoted text, click to view]

AddThis Social Bookmark Button