How to Remove Duplicate Records in Sql Server when Tables have No primary key defined?

 Posted by Vishalneeraj-24503 on 3/1/2015 | Category: Sql Server Interview questions | Views: 525 | Points: 40
Answer:

WITH temp_Table as

(
SELECT ROW_NUMBER() Over(PARTITION BY FirstName,LastName,PAN_No ORDER BY FirstName) As RowNumber,*
FROM Employee_Master;
)
DELETE FROM temp_Table where RowNumber >1;

SELECT * FROM Employee_Master order by FirstName asc;


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response