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
Where in ms sql server is ’100’ equal to ‘0’?
Give me a SQL Query to find out the second largest company?
Do you know what are various aggregate functions that are available?
What is the function of sql server agent windows service?
Tell me when is the update_statistics command used?
What is normalization process?
What are the different types of stored procedures?
how can you select rexcord(rows) from table A which is not present in Table B . Id being the FK in Table B referencing to ID Table A
What do you mean by normalisation?
What are orphan records?
last function used in MS Access to convert sql what function will use in sql
What are the purposes and advantages stored procedure?
What are the steps to process a single select statement?
What is the simplest way to create a new database in ms sql server?
Explain the difference between delete,drop and truncate in SQL Server?