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 create a new table in a given schema?
How to delete a login name in ms sql server?
Write a program using SQL queries to find a unique entry in a table.
If a stored procedure is taking a table data type, how it looks?
Equi join and non equi join is possible with sql server?
Where sql server user names and passwords are stored in sql server? : sql server database administration
What is normalization and its types?
what are the critical issues you have resloved in your company
Can you please differentiate between a primary key and a unique key?
How to create user messages with print statements in ms sql server?
What are the diifferences between the ms sql server vs mysql?
How to Insert multiple rows with a single insert statement?
you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration
What are the steps to insert a table?
What is bulkcopy in sql?