--to remove duplicate employee from tblemployee
In below example tblEmployee is table name and EmployeeNo is a columns
declare @ID varchar(100)
declare @Count int
declare CursorDuplicates Cursor for
SELECT EmployeeNo FROM tblEmployee
open CursorDuplicates
fetch next from CursorDuplicates into @ID
while @@fetch_status=0
begin
select @Count = count(EmployeeNo) from tblEmployee where EmployeeNo = @ID
if @Count > 1
begin
DELETE tblEmployee WHERE CURRENT OF CursorDuplicates
end
fetch next from CursorDuplicates into @ID
end
close CursorDuplicates
deallocate CursorDuplicates