Deprecated: Assigning the return value of new by reference is deprecated in /home/public/wp-content/plugins/pmetrics.php on line 1192

Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' in /home/public/wp-includes/functions.php on line 821
Blended Technologies » Blog Archive » How to change null values into something else in MS SQL Server

How to change null values into something else in MS SQL Server


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/public/wp-includes/functions-formatting.php on line 76

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.

del.icio.us |  Digg |  FURL |  Yahoo! My Web 2.0 |  Reddit

2 Responses to “How to change null values into something else in MS SQL Server”

  1. cco Says:

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/public/wp-includes/functions-formatting.php on line 76

    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

  2. Administrator Says:

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/public/wp-includes/functions-formatting.php on line 76

    Thanks for the correction. I’ll try it out the next time I get my hands on SQL server.