Press "Enter" to skip to content

IS DISTINCT FROM

Andy Brownsword tries out a shortcut:

Comparisons involving NULL-able values and columns are an early learning experience. I recently stumbled upon a relatively new way to handle these which I thought would be interesting T-SQL to share.

I think the two reasons you don’t see this in production are as follows. First, it requires a recent version of SQL Server, 2022 or later. A lot of the T-SQL code that went into training language models was for older versions of SQL Server. Second, because there’s no performance difference, people don’t spend a lot of time changing existing code to use this syntax. It’s a bit clearer in terms of intent, but otherwise doesn’t move the needle for people.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.