Search code examples
sqlsql-serversql-server-2008sql-server-2008-r2distinct

Does SQL Server support IS DISTINCT FROM clause?


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;

Solution

  • 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: