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 2005 Forums
 Transact-SQL (2005)
 removing duplicate data

Author  Topic 

missMac
Posting Yak Master

124 Posts

Posted - 2009-09-09 : 09:18:19
Hello guys,
how do i remove duplicate data in my table ?
thanks

mm

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-09 : 09:21:46
Do Google it. You will find a lot

Madhivanan

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

asgast
Posting Yak Master

149 Posts

Posted - 2009-09-09 : 09:23:28
you delete it :)

how you delete depends on your structure, you should tell us more about the case

the simplest and the worst solution would be
1 select distinct data into temporary table
2 truncate original table
3 insert data from temporary into original
Go to Top of Page

missMac
Posting Yak Master

124 Posts

Posted - 2009-09-09 : 09:38:07
sorted. tnx
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-09-10 : 00:16:48
Hi, u can use this way also

delete t
( select row_number() over( partition by col order by col ) as rid from table ) t
where t.rid > 1
Go to Top of Page
   

- Advertisement -