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...

I have a table EMP in which the values will be like this

EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30

I want to delete only duplicate Rows. After Delete I want
the output like this

EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30



Answer Posted / soorai ganesh

Hey dude, If u use SQLSERVER 2005 This will help u.


;WITH tmpEmp AS
(
SELECT ROW_NUMBER() OVER(PARTITION BY EmpID ORDER BY EmpID)
AS RowNumber, * FROM EMP
)

DELETE FROM tmpEmp WHERE RowNumber> 1

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an indexing technique?

988


What is exclusive locks?

1016


What is resource governor?

1035


What do you mean by 'normalization'?

1123


What are binary string data types in ms sql server?

1395


What is a matrix in ssrs?

158


What is role playing dimension with two examples? : sql server analysis services, ssas

1057


Can a cursor be updated? If yes, how you can protect which columns are updated?

1179


What are sub reports and how to create them?

144


How to add a new dsn with the odbc driver for sql server?

1116


What is transact-sql language?

1135


Explain tables in SQL Azure?

122


What is sub query and its properties?

1027


How do I start sql server 2017?

991


Is oracle faster than sql server?

1009