How to delete exactly duplicate records from a table?
Answer / Mohammad Shavab
You can delete exact duplicate records from a table using the ROW_NUMBER() window function in SQL Server. Here is an example query: DELETE FROM [YourTable] WHERE ROW_NUMBER() OVER (ORDER BY [Column1], [Column2] ...) = ROW_NUMBER() OVER (PARTITION BY [Column1], [Column2]... ORDER BY [Column1], [Column2]...). Replace [YourTable] and the column names with those in your actual table.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?
Can we call a function that has out parameter in select statement
What does executeupdate return?
How to enter date and time literals in ms sql server?
How to store and query spatial data?
How many categories of functions based their return modes?
What is dml command?
How to optimize stored procedure optimization?
Insert syudents details in table.Current system date &time insert into joining time.How do insert?( in sysdate only return current system date how do add time?)
Which are ddl commands?
What is deadlock and how to avoid the deadlocks.
How to execute a sql statement using mssql_query()?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)