August 28, 2006

Removing duplicate rows from SQL Server table

I had a need to remove duplicate rows from a SQL Server table this morning and found this incredibly easy way to do so on the SQL Team site:

select distinct *
into #holding
from dup_authors


truncate table dup_authors

insert dup_authors
select *
from #holding

drop table #holding
 

SQL Team is a great site for finding solutions for those unusual queries that pop up from time to time.

Comments,

  • Trackbacks,
  • and Pingbacks

Comments are closed.

Shortcuts

Where is Dan?


My Blog
My Blog
Twitter
Twitter
Facebook
Facebook
LinkedIn
LinkedIn
Flickr
Flickr
YouTube
YouTube
Delicious
Delicious
Foursquare
Foursquare
Pinterest
Pinterest
GetGlue
GetGlue
Pintley
Pintley
XBOX Live
XBOX Live
Last.fm
Last.fm
Windows Live
Windows Live
Telligent.com
Telligent
Graffiti CMS on CodePlex
Graffiti CMS
Popular

Recent Posts