How to delete duplicate records from a table?(for suppose in
a table we have 1000 Records in that we have 200 duplicate
Records , so ,how to findout that duplicate Records , how to
delete those Records and arranged into sequence order? one
more thing that there is no primary key at all)

Answer Posted / pooja narang

We will get the duplicate records and insert them into a
new temp table by using below query:

select * into tmp_Employee
from Employee
having count(distinct *) > 1

Now delete the duplicate records from Employee table:

delete from Employee
having count(distinct *) > 1

Now insert the records from tmp_Employee to Employee table:

insert into Employee
select * from tmp_employee

drop table tmp_employee

Is This Answer Correct ?    4 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are approximate numeric data types in ms sql server?

595


Do you know how to make remote connection in database?

560


Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?

640


Mention the different types of triggers?

560


What are drilldown reports?

86






Explain log shipping and mention its advantages.

606


how you can configure a running aggregate in SSRS?

114


What is self contained multi valued query?

566


How do you debug a procedure in sql server?

503


What is 1nf 2nf and 3nf?

497


How to find table changes in sql server?

665


Is truncate autocommit?

570


Does sql server 2000 clustering support load balancing?

576


Explain in brief about Microsoft SQL server?

555


Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security

714