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
Tell me what do you mean by an execution plan? Why is it used? How would you view it?
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?
What is the difference between char and varchar2 datatype in sql?
How to insert multiple rows with a subquery?
What is reference section?
What is acid db?
Explain the properties of a relational table?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?
Explain what is dbcc?
How to disconnect from a sql server using mssql_close()?
Explain a differential backup?
How you can add messages to the nt event log from within a stored procedure?
Which is better statement or preparedstatement?
What is oltp (online transaction processing)?