Click here to Skip to main content
15,892,674 members
Articles / Programming Languages / SQL

COUNT of DISTINCT Rows in SQL Server

Rate me:
Please Sign up or sign in to vote.
3.50/5 (3 votes)
26 Nov 2010CPOL 13.9K   4  
Nice tip :)But if you have any column say empid which have the unique constraint then it is better to use the following SQL queryselect count(distinct empid ) from employees

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Database Administrator
India India
I am currently working as a Senior DBA and have around 11 years of experience in database.

Degree:-
Master Degree in Computer(MCA)

Work experience:-
Designing of the database.
Database Optimization.
Writing Complex Stored Procedures,Functions,Triggers etc.
Designing and developing SSIS & DTS packages.
Designing SQL Reports using SSRS.
Database Server Maintenance.

Certification:-
Microsoft certified Sql DBA in Sql server 2008 (MCTS).
Microsoft certified BI professional in Sql server 2008 (MCTS).
Oracle certified profession DBA in ORACLE 10g (OCP)
certified profession DBA in ORACLE 9i (OCP)

My other publication
Technical Blog:- Technologies with Vivek Johari

Moderator and Blogger at BeyondRelational.com

Guest Author and Blogger at sqlservercentral.com

Comments and Discussions