Write a query to delete duplicate records in SQL SERVER

Answer Posted / anuj dhingra

DELETE
FROM MyTable
WHERE ID NOT IN
(
SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicateColumn1, DuplicateColumn2,
DuplicateColumn2)

Is This Answer Correct ?    12 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between primary key and unique constraints?

516


What are commit and rollback in sql?

571


What is update locks?

514


How can you append an identity column to a temporary table?

451


What is the size of transaction log file?

490






Explain few of the new features of sql server 2008 management studio

526


What is the difference between seek predicate and predicate?

591


What do you mean by the term 'normalization'?

674


What are subquery and its properties?

581


What is multilevel indexing?

536


How to get a list of columns using the "sys.columns" view in ms sql server?

562


What are information schema views?

559


Explain cdc and sql injection?

551


When to use null data driven subscription?

148


Can we use trigger new in before insert?

519