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

How to deploy the Report?

95


Explain can you implement data mining in ssrs?

106


What is pivot and unpivot?

642


Your table has a large character field there are queries that use this field in their search clause what should you do?

504


Do you know exporting and importing utility?

533






Why use update_statistics command in sql server?

558


What is serializable?

673


What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration

608


How to encrypt Strored Procedure in SQL SERVER?

556


How to execute a sql statement using odbc_exec()?

574


How to test odbc dsn connection settings?

536


How to remove duplicate rows from table?

601


List the types of recovery model available in sql server?

505


Explain aggregate functions?

561


what are user defined datatypes? : Sql server database administration

520