Write a query to delete duplicate records in SQL SERVER
Answer Posted / sagun sawant
Name Age
chandran 23
ranjith 24
chandran 23
To delete one of the duplicate records use following query
(For sql server 2000)
Set rowcount 1
delete from [tableName] order by name
set rowcount 0
--Write a cursor to delete multiple duplicate records
Or (In sql server 2005)
;with DelDup as (select row_number() over (partition by
sname order by sname) as RONO ,sname from [TableName])
Delete from DelDup where RONO > 1
| Is This Answer Correct ? | 29 Yes | 11 No |
Post New Answer View All Answers
Describe how to use linked server?
Find first and last day of current month in sql server
How to name query output columns in ms sql server?
What is the difference between for xml raw and for xml auto?
Explain how to send email from sql database?
What the class forname () does?
How to use old values to define new values in update statements in ms sql server?
Explain the disadvantages/limitation of the cursor?
What command is used to delete a table from the database in the sql server and how?
Explain indexed views?
What is log cache in sql server?
What are the joins in sql server? : sql server database administration
What is the difference between web edition and business edition?
What is an example of a primary key?
How to create prepared statements using odbc_prepare()?