Friday, September 11, 2009

To find dupliactes in a table data - sql

here is the code for find out is there is any duplicates in the table data or not.

WITH T1 AS
(
Select szname, ROW_NUMBER()
OVER (PARTITION BY szname Order By szname) AS NUMBER From tblUsers
)
select * from T1 where Number>1

here Number is the number of dupliacation of a single record.

No comments: