Is it possible to delete duplicate rows in a table without
using a temporary table ?

Answer Posted / kalyan.k

yes,it is possible.

By using row_number function.

dept table contains two columns(eid,ename)

eid dname

1 k
1 j
1 u
2 k
2 j
2 u


with [dept ordered by eid] as
(
select row_number()over(partition by ei order by eid)as
rowid,* from dept
)
delete from [dept ordered by eid] where rowid >1

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How you can find out if an index is useful to the optimizer?

486


Explain candidate key, alternate key, and composite key?

582


What is faster join or union?

590


Explain in details security in SQL azure?

97


How to create an index on an existing table in ms sql server?

491






How is a full-text index updated?

526


What is format parameter in ssrs?

109


how to avoid cursors? : Sql server database administration

483


Why normalization is used?

544


Can you leave a union at any time?

526


What is the use of keyword with encryption.

570


Tell me the use of keyword with encryption. Create a store procedure with encryption?

542


What is raid and what are different types of raid levels?

582


What the class forname () does?

530


What are the properties of the transactions?

606