Wednesday, August 20, 2014

1.DELETE DUPLICATE RECORD ALREADY IN TABLE?

Sol:
WITH TempEmp (EMPID,DUPCATE)
AS
(
SELECT EMPID,ROW_NUMBER() OVER(PARTITION by EMPID, Salary ORDER BY EMPID)
AS DUPCATE
FROM EMPP
)
--Now Delete Duplicate Records
DELETE FROM TempEmp
WHERE DUPCATE > 1
.........................................................end...................................................................................

No comments:

Post a Comment