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 are the different types of lock modes in sql server 2000?
I have a table Events Events containing cardno,time,id,name--each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible
Can we store videos inside the sql server table?
How to test subquery results with the exists operator?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
How to perform backup for certificates in sql server? : sql server security
Do you know what are various aggregate functions that are available?
What are sql server functions?
What is bcp? When does it used?
Explain full-text query in sql server?
What were the latest updates to SQL Azure service?
What is the purpose of the tempdb database?
How to disconnect from a sql server using mssql_close()?
What is RMS migrations?
How do you test your database? : sql server database administration