>Hi All:
> I have duplicate records in one table that is part of Sql Server. How can I delete all the duplicate records in the table and preventing this from happening again in the future ?
>Thanks
I'm not familiar with SQL Server, but I think, this would work:
select count(*) as cntDups, KeyID from yourtable ;
group by KeyID ;
having cntDups>1 ;
into cursor curDups
delete from YourTable where KeyID not in (select KeyID from curDups)
If it's not broken, fix it until it is.
My Blog