Want to work with us? We're on the lookout for digital experts.

We're hiring

NULL Values in MS SQL

Web Bureau

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


COALESCE(field1,'') + (CASE WHEN field2 IS NULL THEN '' ELSE ' | ' + field2 END)

Grow your businessStart a project with us today.

This site uses essential cookies for parts of the site to operate and have already been set. Find out more about how we use cookies and how you may delete them. You may delete cookies, but parts of the site will not work.