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...

how to delete duplicate rows in sql server2005

Answer Posted / arunkumar_mlx

WITH A
AS
(
SELECT ROW_NUMBER() OVER ( PARTITION BY
columnname_1,columnname_2 ORDER BY columnname_1) AS
duplicate FROM table_name
)
SELECT * FROM A WHERE duplicate>1
--DELETE FROM A WHERE duplicate>1

First select and you can find the row_number having more
than 1 rows.

Then delete them on comment of select stmt inside the
query..
decomment of that delete stmt will delete the duplicate
rows.

Is This Answer Correct ?    8 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is snapshot parameter in ssrs?

150


what is denormalization and when would you go for it? : Sql server database administration

1201


What is set nocount on and what is set nocount off?

935


What is dbcc updateusage?

1211


List out different types of normalizations in sql server and explain each of them?

934


What is difference between index seek vs. Index scan?

1156


Where is trigger in sql server?

1050


What are the new security features added in sql server 2012? : sql server security

1029


What are the steps to process a single select statement?

944


How to use wildcard characters in like operations in ms sql server?

1139


What is sql server profiler?

1012


Explain activity monitors

1082


Explain timestamp datatype?

976


How do you open a cluster administrator?

1054


What is always encrypted?

1003