Robert L. Stewart
robert at webedb.com
Wed Mar 19 15:22:13 CDT 2008
Mark, As other have said, cursors are slow. After you get it cleaned up, I would put a unique index on the 2 columns so that the problem is solved permanently. Robert At 09:21 AM 3/19/2008, you wrote: >Date: Tue, 18 Mar 2008 20:46:01 +0000 >From: Mark A Matte <markamatte at hotmail.com> >Subject: [dba-SQLServer] Duplicate records >To: Discussion concerning MS SQL Server > <dba-sqlserver at databaseadvisors.com> >Message-ID: <BAY127-W56BC25631929C6E0D287ACD2060 at phx.gbl> >Content-Type: text/plain; charset="iso-8859-1" > > >Hello All, > >I have a large table that occasionally duplicates make it into. The >2 fields that make the record unique are Case_ID and >Note_Seq_Nbr. The duplicates are identical...so I have no primary >key. I used the code below. It doesn't run very fast...but it does >the job of removing just the extra records... > >Any thoughts,comments, or suggestions on making it >faster/better...or a totally different approach? > >Thanks, > >Mark A. Matte