Differences
This shows you the differences between two versions of the page.
— |
howto:replace_nulls_with_blanks_in_sql_server [2011/12/19 21:33] (current) smark created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How To Replace Nulls With Blanks In SQL Server ====== | ||
+ | <code> | ||
+ | UPDATE | ||
+ | table | ||
+ | SET | ||
+ | field = '' | ||
+ | WHERE | ||
+ | ISNULL(field, 'dummyvalue') = 'dummyvalue' | ||
+ | </code> | ||
+ | |||
+ | ISNULL checks if "field" is null and if it is null it returns 'dummyvalue', if that's equal to 'dummyvalue' then it sets the field to '' (which is NOT the same as null in SQL Server). |