Louis Davidson likes a new operator in SQL Server 2022:
The MOST exciting change from a T-SQL standpoint is:
IS NOT DISTINCT FROM
. This feature solves an age-old issue for T-SQL programmers and is worth its weight in gold. It is basically an equals comparison operator like =, but treatsNULL
as an individual value. Unlike =, this new operator returns onlyTRUE
orFALSE
, but notUNKNOWN
. Writing queries that compare to values that can containNULL
is tedious, mostly because of code like the following:
Louis is quite happy here. I like the fact that the syntax is here, though I’d be concerned about performance—the syntax is nicer but you can run into the same performance issues as you’d have with “NULL or match” type queries.
Comments closed