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
What is mean by dml?
What method is used by the Command classes to execute SQL statements that return single values?
Name 3 ways to get an accurate count of the number of records in a table?
you notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it? : Sql server administration
What options are there to delete rows on the publisher and not on the subscriber? : sql server replication
How do you run a trace?
What does normalization do to data?
How do I run a trace in sql server?
Do you know what is difference between index seek vs. Index scan?
How to download and install the scaled-down database adventureworkslt?
What are the new data types are introduced in sql 2000?
What is scalar user-defined function?
What is the difference between the application object and session object?
What are the events recorded in a transaction log?
Why I am getting "the microsoft .net framework 2.0 in not installed" message?