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 are the different acid properties?
Define model database?
Explain transaction isolation levels in sql server?
What is SQL Azure?
What is proper subset of candidate key?
In case you have filters in your report, when filters will be applied in cached report instance?
What type of locking occurs during the snapshot generation? : sql server replication
How to delete existing triggers using "drop trigger"?
What is a view in sql?
How do I start sql server 2016?
What is an sql server agent?
What are the types of table?
How to check what was the last restore transaction LSN in Log shipping or Mirroring? when we don't have a Monitor or witness server.
Explain timestamp datatype?
What is resource db in sql server?