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
 SQL Server Administration (2005)
 Removing duplicate data

Author  Topic 

venkath
Posting Yak Master

202 Posts

Posted - 2009-02-17 : 13:01:32
Hi all

How to remove duplicte records from a table which has no primary key in it.

I have a table with the data like this

Table
-----
col1 col2
---- ----
1 a
2 b
1 a
2 b
. .
. .
. .
.
.

Thanks in advance.

mfemenel
Professor Frink

1421 Posts

Posted - 2009-02-17 : 13:03:24
You can use distinct to select them out. How many rows in your table?

select distinct col1,col2 into holdertable from primarytable

Mike
"oh, that monkey is going to pay"
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2009-02-17 : 13:24:46
Read thru this,
http://www.sqlteam.com/article/deleting-duplicate-records
Go to Top of Page
   

- Advertisement -