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 avoid cursors? : Sql server database administration
What command do we use to rename a database?
Does the order of columns in update statements matter?
What do you mean by recursive stored procedure?
Is port 1433 secure?
Can group functions be mixed with non-group selection fields in ms sql server?
What is data block and how to define data block size?
How to skip remaining statements in a loop block using continue statements?
What are the types of sql server?
How many primary keys are possible in a table?
What is ms sql server reporting services?
Why would you use sql agent?
Explain logical operators in sql server?
what do you understand by change data capture?
How to add the custom code in Report?