Microsoft Data Technology · Microsoft SSDB · Transact SQL

TSQL – Part 1(d) – Working with NULLS

  • NULL is used to indicate an unknown or missing value. NULL is not equivalent to zero or an empty string.
  • Arithmetic or string concatenation operations involving one or more NULL operands return NULL. For example, 12 + NULL = NULL.
  • If you need to compare a value to NULL, use the IS operator instead of the = operator.
  • The ISNULL function returns a specified alternative value for NULL columns and variables.
  • The NULLIF function returns NULL when a column or variable contains a specified value.
  • The COALESCE function returns the first non-NULL value in a specified list of columns or variables).

 

 

 

Additional Reading

Review the documentation for the ISNULL function and Expressions in the Transact-SQL Reference.

Note: Microsoft is the owner of the content and video in this blog post.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s