Write a query to delete duplicate records in SQL SERVER

Answer Posted / skumar

Hi friends, please just try out this. This works fine for me.

We have lot of methods to do this. But using temp table,
drop the original table,retain the temp as orinial is not a
good pratice.

When u have large no of data it will affect ur performance.


DELETE FROM employee WHERE((SELECT eid,COUNT(eid) FROM
employee GROUP BY eid) > 1)

Is This Answer Correct ?    15 Yes 46 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you

1305


What is the new security features added in sql server 2014? : sql server security

567


What does REVERT do in SQL Server 2005?

563


What do you mean by SQL injection attack?

621


What samples and sample databases are provided by microsoft?

576






What method is used by the Command classes to execute SQL statements that return single values?

605


What is SQL Server?

663


What are the 3 types of schema?

598


Write a code to select distinct records without using the DISTINCT keyword.

649


How do I find the port number for sql server?

504


How can I tell if sql server is 32 or 64 bit?

501


What is amo? : sql server analysis services, ssas

671


What is partition index in sql server?

608


How to filter out duplications in the returning rows in ms sql server?

637


Is there any difference between primary key and unique with the not null condition?

529