How to change null values into something else in MS SQL Server
You must use:
update [table] set [field]='value you want' where isnull([field],1)=1
This page shows how to do this in all the DBs.
–
You must use:
update [table] set [field]='value you want' where isnull([field],1)=1
This page shows how to do this in all the DBs.
–
September 21st, 2005 at 7:16 pm
This doesn’t do exactly what you think it does. While it will set all NULL values of field to the value you want, it will also change any value of field that is = 1.
The correct way to do this is simple:
update [table] set [field]=’value you want’ where [field] is null
September 21st, 2005 at 7:21 pm
Thanks for the correction. I’ll try it out the next time I get my hands on SQL server.