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
You want to implement the one-to-one relationship while designing tables. How would you do it?
Can select statements be used on views in ms sql server?
What is multi-statement table-value user-defined function?
What are out-of-range errors with date and time literals?
Explain features of analysis services?
What is the native system stored procedure to execute a command against all databases?
Why functions are used in sql server?
What is molap and its advantage? : sql server analysis services, ssas
You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?
What is the difference between mysql and sql server?
Define cursor locking
What are logical/boolean operations in ms sql server?
What is an identity column in insert statements?
You have modified 100 store procedures and want to replicate these changes from development to prodution, and production can have users using the Server/DB, how would you replicate without causing issues?
What are drillthrough reports?