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
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?
how we use window authentication connection with sql server.?
What are the different SQL Server Versions you have worked on?
What is transact-sql language?
Where are sql server user names and passwords stored in sql server?
Why use view instead of a table?
How to execute stored procedure in select statement sql server?
How many types of triggers in sql server?
Why it is recommended to avoid referencing a floating point column in the where clause?
How data can be copied from one table to another table?
What are the purposes of floor and sign functions?
What are indexes in ms sql server?
what is a join and explain different types of joins? : Sql server database administration
Explain activity monitors
What is the Difference Between Primary and Foreign Key?