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

Can you use order by when defining a view?

571


What is a scheduled job or what is a scheduled task?

535


What is the difference in accessing db between sql server vs sql azure?

157


What is collation sensitivity? Explain different types.

541


Explain the flow of creating a cube? : sql server analysis services, ssas

620






What is snapshot parameter in ssrs?

109


What is partition index in sql server?

602


What is SQL Azure?

85


How to retrieve error messages using odbc_errormsg()?

538


What is the use of commit?

540


What is table value parameters (tvp)?

537


How to enable tcp/ip protocol on a sql server?

587


What is sql server profiler?

567


What are the default system databases in sql server 2000?

536


How to find the source of a table in sql server?

523