adspace


Write a sql query to delete duplicate records from a table called table1

Answer Posted / Vipin Sonkar

You can delete duplicate rows from a table in SQL Server using the ROW_NUMBER() window function:

```sql
WITH cte AS (
SELECT *,
ROW_NUMBER() OVER(ORDER BY YourColumn) as rownum
FROM Table1
)
DELETE FROM cte WHERE rownum > 1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we do dml on views?

1039


How to remove duplicate rows from table except one?

1091


Can you index views?

955


Why use identity in sql server?

1203


How do I create a trace in sql server?

1121


Equi join and non equi join is possible with sql server?

1134


Where can you add custom error messages to sql server?

1215


what is spatial nonclustered index

1060


Does view occupy space?

1022


How raid can influence database performance?

1119


What are the source of constraints?

1010


How to rebuild the master database?

1167


what is the Ticketing tool used in Wipro technologies at Bangalore...???

8232


What is temporary table in sql server? Why we use temp table?

1023


How efficient you are in oracle and SQL server?

1258