23

Does SQL Server support IS DISTINCT FROM statement which is SQL:1999 standard? E.g. the query

SELECT * FROM Bugs WHERE assigned_to IS NULL OR assigned_to <> 1;

can be rewritten using IS DISTINCT FROM

SELECT * FROM Bugs WHERE assigned_to IS DISTINCT FROM 1;
jrara
  • 16,239
  • 33
  • 89
  • 120
  • 2
    Yes, [IS NOT DISTINCT FROM (Transact-SQL)](https://learn.microsoft.com/en-us/sql/t-sql/queries/is-distinct-from-transact-sql?view=sql-server-ver16) – Lukasz Szozda Jul 28 '22 at 04:52
  • Looks like that feature isn't in a stable version of SQL Server yet. – binki Jul 28 '22 at 13:50

1 Answers1

23

IS [NOT] DISTINCT FROM is scheduled to be included in SQL Server 2022 (currently in public preview), see:


For earlier versions of SQL Server, the following SO question explains how to work around this issue with equivalent (but more verbose) SQL Server expressions:

Heinzi
  • 167,459
  • 57
  • 363
  • 519