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

Can foreign key be deleted?

975


What is nolock?

1035


What is public role in sql server?

1206


You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?

1087


Why use update_statistics command in sql server?

1109


What will be the maximum number of indexes per table?

1015


What is a file group?

1161


Do you know what is xpath?

1151


Does index speed up select statements?

1072


List all the types of user-defined functions?

1177


Why functions are used in sql server?

1012


What are “phantom rows”?

1702


How to list all triggers in the database with sys.triggers in ms sql server?

1123


State the difference between union and union all?

982


Which tcl commands are available on the sql server?

1135