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
Determine how to use the inserted and deleted pseudo tables?
How do I find the port number for sql server?
What is #temp and @table variable in SQL server?
What is the dbcc command and why is it used?
What is the difference between NOROW and LOCKROW?
What is the standby server?
What are the advantages of using cte?
List the different index configurations possible for a table?
Using the customer, and order table in northwind database, please write a query to produce xml?
How do you rebuild an identity column?
What is oltp (online transaction processing)?
Can we shrink data file in sql server?
What is table level trigger?
What is postgresql server?
How to send email from database?