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

Do you know hot add cpu in sql server 2008?

907


What is SQL Azure?

105


What are the advantages of passing name-value pairs as parameters?

1118


How can we get count of the number of records in a table?

908


What is the difference between seek predicate and predicate?

996


Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?

825


How to create a view using data from another view?

910


How to change the password of a login name in ms sql server?

969


What is data modification?

902


Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?

1035


List down some advantages of sql stored procedure?

914


What is the fastest way to permanently delete a 1 million row table named customers?

1170


Explain the difference between function and stored procedure?

904


What is difference between primary key and foreign key?

840


You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?

306