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 to apply filtering criteria at group level with the having clause in ms sql server?
What are the properties of the transaction?
How to use go command in "sqlcmd"?
Explain an automatic checkpoint
Explain insert into select statement?
What are the advantages of user defined function?
What are sub reports?
When we should use @@error?
What are the fixed server level roles? : sql server security
How to generate create view script on an existing view?
How many types of triggers are there?
What do you mean by cardinality?
Due to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?
How to use order by with union operators in ms sql server?
What are the benefits and tasks of object explorer? : sql server management studio