Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain foreign key in sql server?

1030


What is the New in SQL server 2008?

975


Does sql server 2000 clustering support load balancing?

976


How can I track the changes or identify the latest insert-update-delete from a table?

962


What stored procedure would you use to view lock information?

975


Mention the differences between sql server and mysql.

1015


Do you know what is normalization of database? What are its benefits?

1122


What is store procedure? When do you use?

936


What is nested transaction?

1101


What does man by sql wildcard characters in sql server?

1060


Explain database normalization?

1226


Ms sql server index?

1064


Do you know what is difference between index seek vs. Index scan?

954


What is a view in sql?

976


how can you select rexcord(rows) from table A which is not present in Table B . Id being the FK in Table B referencing to ID Table A

1682