Delete duplicate records from the table?(Table must have
unique id)

Answer Posted / kk

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

Is This Answer Correct ?    7 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we write trigger for view?

549


what is a schema in sql server 2005? : Sql server database administration

508


List all types of constraints in sql server?

509


What are constraints?

579


What is primary key index?

530






You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?

1719


Tell me about joins in database system and explain each in detail.

584


Create and insert into temp table in sql server?

575


Explain syntax for viewing trigger?

532


Is candidate a key?

526


How to remove duplicate rows from table?

587


How many full-text indexes can a table have?

545


What is inner join in sql server joins?

536


Difference between Sql server reporting services and Crystal reports?

124


Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

2024