if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 duplicate and 1 original as it is,how?

Answer Posted / dhananjay

The simplest way to eliminate the duplicate records is to
SELECT DISTINCT into a temporary table, truncate the
original table and SELECT the records back into the original
table. That query looks like this:

select distinct *
into #holding
from dup_authors

truncate table dup_authors

insert dup_authors
select *
from #holding

drop table #holding

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference RDBMS and Graph Database?

809


What are three ways you can use an identity value inside a trigger? Why would you prefer one way over another?

754


What are the source of constraints?

676


Does view occupy space?

706


Can you insert NULL in unique column?

841


Does the unique constraint create an index?

746


What is rank function?

802


do you know how to configure db2 side of the application? : Sql server database administration

791


How do I schedule a sql server profiler trace?

705


Can I use sql azure as a backup with log shipping or database mirroring?

148


What is xdr?

758


What are the advantages of using stored procedures in sql server?

706


What is the recursive stored procedure in sql server?

724


can you instantiate a com object by using t-sql? : Sql server database administration

719


Is sql server free?

680