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
How to download and install microsoft .net framework version 2.0?
Can we call future method from queueable?
How can you tell if a database object is invalid?
What are the new features in SQL Server 2005 when compared to SQL Server 2000?
What is the use of builtinadministrators group in sql server? : sql server security
What is tablix?
Does full backup break log chain?
What are the key configuration files for sql server reporting services ?
What is local temp table?
How do I create a trace in sql server?
How to find out the list schema name and table name for the database?
Tell me what is sql profiler?
Which autogrowth database setting is good?
How to create a local temporary stored procedure?
Which operator do you use to return all of the rows from one query except rows are returned in a second query?