SQL Server does not support
COUNT(DISTINCT *)
. For example, the below query fails.
SELECT COUNT(DISTINCT *) FROM Employees
The error message generated is:
Incorrect syntax near '*'
Instead, use the below query:
SELECT COUNT(*) FROM (SELECT DISTINCT * FROM Employees) Emp
Note: This is specifically useful when you want 'DISTINCT *' - without coloumn name(s)