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
What is an indexing technique?
What is exclusive locks?
What is resource governor?
What do you mean by 'normalization'?
What are binary string data types in ms sql server?
What is a matrix in ssrs?
What is role playing dimension with two examples? : sql server analysis services, ssas
Can a cursor be updated? If yes, how you can protect which columns are updated?
What are sub reports and how to create them?
How to add a new dsn with the odbc driver for sql server?
What is transact-sql language?
Explain tables in SQL Azure?
What is sub query and its properties?
How do I start sql server 2017?
Is oracle faster than sql server?