how to delete duplicate rows from table in sql server
Answer Posted / eashwar v
IN SQL SERVER 2005, This can be easily achieved without
crating unique identifier by using CTE and ROW_NUMBER (),
the modified query for sql server 2005 goes here
***********************************************
WITH T1 AS (SELECT ROW_NUMBER ( ) OVER ( PARTITION BY ID,
FNAME, LNAME ORDER BY ID ) AS RNUM FROM DUPLICATE )
DELETE FROM T1 WHERE RNUM > 1
***********************************************
To get a detail grasp on ROW_NUMBER () OVER () … Refer MSDN
http://msdn2.microsoft.com/en-us/library/ms186734.aspx for.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How would we use distinct statement? What is its use?
what is the primary use of the model database? : Sql server administration
How to create a ddl trigger using "create trigger" statements?
What does sql server mean?
How to transfer an existing table from one schema to another schema in ms sql server?
What are trace flags and mention a few common trace flags used with sql server?
Tell me what is fill factor?
What are the features of Embedded SQL
What is sql azure database?
What is the chart in report?
What are the kinds of subquery?
What is tablesample?
What stored by the master? : sql server database administration
How to stop log file growing too big?
Can you explain what is indexed view? How to create it?