Supppose we have a table without primary key and duplicate records get entered.The problem arises when you have two identical rows in the table and there is no way to distinguish between the two rows.then how do you delete the duplicate record?
Solution
You have a table named tblEmp with Duplicate EmpIds
EmpID
Manpreet
Manpreet
Manpreet
Sandeep
Sandeep
Sandeep
Sandeep
Vikas
Vikas
You can Delete duplicate records with Top Command
DELETE TOP (SELECT COUNT(*) -1 FROM dbo.tblEmp WHERE EmpID = 'Manpreet')
FROM dbo.tblEmp
WHERE EmpID = 'Manpreet'
Solution
You have a table named tblEmp with Duplicate EmpIds
EmpID
Manpreet
Manpreet
Manpreet
Sandeep
Sandeep
Sandeep
Sandeep
Vikas
Vikas
You can Delete duplicate records with Top Command
DELETE TOP (SELECT COUNT(*) -1 FROM dbo.tblEmp WHERE EmpID = 'Manpreet')
FROM dbo.tblEmp
WHERE EmpID = 'Manpreet'
Comments