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
what stored procedure can you use to display the current processes? : Sql server administration
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
What do you think of this implementation? Can this be implemented better?
Define a cross join?
What is the temp table?
What is isnull() operator?
Explain what is “asynchronous” communication in sql server service broker?
What is partitioned view?
what are the different types of SSRS reports?
Which language is supported by sql server?
What is bcp? When does it used?
How do I repair damaged sql server mdf file database? In previous day my mdf file has got damage due to unknown reasons then I used dbcc chekcdb command but it failed, MDF file is important for me, I don’ know that how to get back mdf file data. Please anyone suggest me?
How do you know if sql server is running on your local system?
How to modify an existing user defined function?
What are trace flags and mention a few common trace flags used with sql server?