15 January 2013 by Web Bureau
Couple of things I have come across recently with NULL values:
CONCATENATING when one field has NULL value
This can happen when you are building up a number of fields to compare against a search string. Either COALESCE or ISNULL will do the trick.
WHERE COALESCE(p.field1,'') + COALESCE(p.field2,'') + COALESCE(p.field3,'') LIKE @SearchText
SQL NOT IN constraint and NULL values
OPPOSITE OF COALESCE
COALESCE(field1,'') + (CASE WHEN field2 IS NULL THEN '' ELSE ' | ' + field2 END)