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 / rajnish kumar pandey

WITH TempTable(Col1, Col2, DuplicateCount)
AS
(
SELECT Col1, Col2,
ROW_NUMBER() OVER(PARTITION BY id, roles ORDER BY id) AS
DuplicateCount
FROM MainTable
)
DELETE
FROM TempTable
WHERE DuplicateCount > 1
GO

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the dbcc pintable command when would you use it?

904


Are all views updatable ?

1140


What is table value parameters (tvp)?

1091


How to execute stored procedure and set temp table in sql server?

1029


What is a natural primary key?

1014


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

1078


Explain about sql server login?

1072


When would you use a before or after trigger?

902


What is report subscription?

123


What are database states in ms sql server?

1169


What new changes are being made in SQL Server?

1170


how you can deploy an ssrs report?

178


What is your recommendation for a query running very slow? : sql server database administration

1034


Where sql server user names and passwords are stored in sql server? : sql server database administration

1041


Show Practically Sql Server Views are updatable?

1109