Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain the cursor lock types?

1097


What is the cartesian product of the table?

1003


What is the difference between the application object and session object?

1121


How many types of keys are there?

1073


How to rebuild master databse?

1127


Is mysql the same as sql server?

1031


can any body tell me how to know the password of current user in sql server

2119


Determine how to use the inserted and deleted pseudo tables?

1043


Call by value and call by reference in procedure and function, with NOCOPY.

1349


What are the ways available in sql server to execute sql statements?

1205


What causes index fragmentation?

1045


difference between Clustered index and non clustered index ?

1034


What are statistics?

1050


Explain ranking functions?

1094


What is the usage of sign function?

1175