adspace


How to delete exactly duplicate records from a table?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is clustered index

1087


Does view occupy space?

1021


How to connect php with different port numbers?

1191


How raid can influence database performance?

1119


How can I check that whether automatic statistic update is enabled or not?

1113


What is sql or structured query language?

1228


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

1300


What is in place upgrade in sql server?

1127


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

1041


Why use identity in sql server?

1202


Can you index views?

955


what is the difference between openrowset and openquery?

1197


What kind of problems occurs if we do not implement proper locking strategy?

1500


List the ways in which dynamic sql can be executed?

1087


Can one drop a column from a table?

1091