how to delete duplicate rows in sql server2005
Answer Posted / arunkumar_mlx
WITH A
AS
(
SELECT ROW_NUMBER() OVER ( PARTITION BY
columnname_1,columnname_2 ORDER BY columnname_1) AS
duplicate FROM table_name
)
SELECT * FROM A WHERE duplicate>1
--DELETE FROM A WHERE duplicate>1
First select and you can find the row_number having more
than 1 rows.
Then delete them on comment of select stmt inside the
query..
decomment of that delete stmt will delete the duplicate
rows.
| Is This Answer Correct ? | 8 Yes | 4 No |
Post New Answer View All Answers
What is snapshot parameter in ssrs?
what is denormalization and when would you go for it? : Sql server database administration
What is set nocount on and what is set nocount off?
What is dbcc updateusage?
List out different types of normalizations in sql server and explain each of them?
What is difference between index seek vs. Index scan?
Where is trigger in sql server?
What are the new security features added in sql server 2012? : sql server security
What are the steps to process a single select statement?
How to use wildcard characters in like operations in ms sql server?
What is sql server profiler?
Explain activity monitors
Explain timestamp datatype?
How do you open a cluster administrator?
What is always encrypted?