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 / sagun sawant

Name Age
chandran 23
ranjith 24
chandran 23

To delete one of the duplicate records use following query

(For sql server 2000)

Set rowcount 1
delete from [tableName] order by name
set rowcount 0
--Write a cursor to delete multiple duplicate records
Or (In sql server 2005)

;with DelDup as (select row_number() over (partition by
sname order by sname) as RONO ,sname from [TableName])
Delete from DelDup where RONO > 1

Is This Answer Correct ?    29 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a coalesce function?

1270


What is sql or structured query language?

1208


What is clustered index

1079


What are wait types?

1227


What is the difference between upgrade and migration in sql server?

1166


Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?

1018


How do I start sql server 2017?

1003


Why and when do stored procedure recompile?

1044


What are the different SQL Server Versions you have worked on?

1071


Is it possible to have clustered index on separate drive from original table location?

1031


What are the pros and cons of putting a scalar function in a queries select list or in the where clause?

1284


Can you index views?

951


How to connect php with different port numbers?

1163


Why we use the openxml clause?

1059


Explain “row_number()” in sql server with an example?

1062