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
What does this statement do @@rowcount?
How do you Implement SSIS Packages in your Project?
What is the importance of a recovery model?
Does group by or order by come first?
What is partition, how will you implement it? : sql server analysis services, ssas
what is the difference between writing data to mirrored drives versus raid5 drives. : Sql server administration
Hi all, can any one please tell me the difference between sql server 2008 and orace 9i
Beginning with sql server version 7 0, a new enhanced data type nchar was added what type of data is supported with this data type?
How can we call UDF(User Define Function) using C# code in ASP.net ?
How do I trace a query in sql server?
What are .mdf files?
What are the different ways you can create databases in sql server?
What are the hotfixes and patches in sql server?
Why the trigger fires multiple times in single login?
What do you mean by data manipulation language?