Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how to delete a duplicate row from table.

Author  Topic 

ramana123
Yak Posting Veteran

57 Posts

Posted - 2005-10-11 : 04:30:15
hi all,
can you tell me how to delete a duplicate row from the table but i needt o maintain one copy of the row ..remaining have to delete ..is it possible in single sql query..
thansk
ramns123

HCLollo
Starting Member

49 Posts

Posted - 2005-10-11 : 04:53:09
Mmm...do your table have an identity column or not?
If it has, just delete all row that match your query, save for one,
otherwise push the row in a temp table, delete the rows and write
back the temp data in your table (though probably you'll need more
than just one query to do this, need to check )

HCL


"If it works fine, then it doesn't have enough features"
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-10-11 : 05:00:13
Can you post ur table structure so that we can work around with that


Complicated things can be done by simple thinking
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-11 : 05:01:54
There's a link to "Deleting Duplicate Records" in the "Frequently Given Answers" thread at the top of the "New to SQL Server" forum.

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-12 : 01:42:57
Also refer these
http://sqlteam.com/forums/topic.asp?TOPIC_ID=6256
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q139444


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -