Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
like image 796
jrara Avatar asked Sep 17 '12 09:09

jrara


People also ask

Is distinct from in SQL Server?

The SQL Server (Transact-SQL) DISTINCT clause is used to remove duplicates from the result set. The DISTINCT clause can only be used with SELECT statements.

Is distinct a clause in SQL?

SQL DISTINCT clause is used to remove the duplicates columns from the result set. The distinct keyword is used with select keyword in conjunction. It is helpful when we avoid duplicate values present in the specific columns/tables. The unique values are fetched when we use the distinct keyword.

Can distinct be used in where clause?

By using the WHERE clause with a DISTINCT clause in MySQL queries, we are putting a condition on the basis of which MySQL returns the unique rows of the result set.

Does SQL Server support using clause?

SQL Server doesn't support the USING clause, so you need to use the ON clause instead. The USING clause can be used with INNER, LEFT, RIGHT, and FULL JOIN statements.


1 Answers

No, it doesn't. The following SO question explains how to rewrite them into equivalent (but more verbose) SQL Server expressions:

  • How to rewrite IS DISTINCT FROM and IS NOT DISTINCT FROM?

There's also a Uservoice entry for this issue, where you can vote for inclusion in the next release:

  • Add language and optimizer support for ISO <distinct predicate>
like image 161
Heinzi Avatar answered Sep 21 '22 21:09

Heinzi