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
Explain the dbcc pintable command when would you use it?
Are all views updatable ?
What is table value parameters (tvp)?
How to execute stored procedure and set temp table in sql server?
What is a natural primary key?
What is the difference between upgrade and migration in sql server?
Explain about sql server login?
When would you use a before or after trigger?
What is report subscription?
What are database states in ms sql server?
What new changes are being made in SQL Server?
how you can deploy an ssrs report?
What is your recommendation for a query running very slow? : sql server database administration
Where sql server user names and passwords are stored in sql server? : sql server database administration
Show Practically Sql Server Views are updatable?