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
Write a program using SQL queries to find a unique entry in a table.
What are the different types of triggers in SQL SERVER?
How to create a trigger for insert only?
How to skip remaining statements in a loop block using continue statements?
wat wil hapn if we give the both read and deny read permission to user?
What are the general features of sql server management studio? : sql server management studio
What is it unwise to create wide clustered index keys?
What are the 10 characteristics of data quality?
How to drop an existing table?
Can we return Data from 4(more than 1) tables in stored procedure?
How to search for a string in all stored procedure in sql server?
What is dimension table? : sql server analysis services, ssas
What are the functions in sql server?
What is instead of dml trigger?
Which event (check constraints, foreign key, rule, trigger, primary key check) will be performed last for an integrity check?