Write a query to delete duplicate records in SQL SERVER

Answer Posted / vaishali

set rowcount 1
delete from stud
where (select count(*) from stud a where stud.roll_no =
a.roll_no) > 1
while @@rowcount<>0
delete from stud
where (select count(*) from stud a where stud.roll_no =
a.roll_no) > 1
set rowcount 0

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

you have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation? : Sql server administration

544


What the different types of Replication and why are they used?

546


sql database suspect We have a sql database that is showing as suspect. How can we recover?

1406


What are the advantages of partitioning?

646


What are the character string functions supported by sql server 2005?

524






Explain error and transaction handling in sql server?

506


Define inner join in sql server joins?

535


What is a view and what are its advantages?

692


Explain microsoft sql server functions?

546


How to delete exactly duplicate records from a table?

607


Can you leave a union at any time?

546


what is a default tcp/ip socket assigned for sql server? : Sql server database administration

535


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

561


What is dml command?

553


Tell me extended events in sql server 2008?

564