Write a query to delete duplicate records in SQL SERVER
Answer Posted / senthilsjc
This query delete duplicate records(but not delete both
duplicate)
set rowcount 1
delete yourtable
from yourtable a
where (select count(*) from yourtable b where b.name=a.name
and b.age=a.age)>1
while @@rowcount >0
delete yourtable
from yourtable a
where(select count(*) from yourtable b b.name=a.name and
b.age=a.age)>1
set rowcount 0
| Is This Answer Correct ? | 6 Yes | 12 No |
Post New Answer View All Answers
Explain the cursor lock types?
What is the cartesian product of the table?
What is the difference between the application object and session object?
How many types of keys are there?
How to rebuild master databse?
Is mysql the same as sql server?
can any body tell me how to know the password of current user in sql server
Determine how to use the inserted and deleted pseudo tables?
Call by value and call by reference in procedure and function, with NOCOPY.
What are the ways available in sql server to execute sql statements?
What causes index fragmentation?
difference between Clustered index and non clustered index ?
What are statistics?
Explain ranking functions?
What is the usage of sign function?