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 / guest
WITH T1 AS (
SELECT ROW_NUMBER () OVER ( PARTITION BY EmpId ORDER BY
EmpId) AS RNUM,EmpId FROM EMP)
delete
FROM T1 WHERE RNUM > 1
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain the ways to controlling cursor behavior?
What is the purpose of optimization?
What does it mean to manipulate data?
How to enter date and time literals in ms sql server?
What is a scheduled job or what is a scheduled task?
Why use stored procedures in sql server?
why would you use sql agent? : Sql server database administration
What are sp_configure commands and set commands?
How do I shrink an ldf file?
Explain few examples of stored procedure over triggers?
How can sql injection be stopped? : sql server security
Where are full-text indexes stored?
You want to implement the one-to-many relationship while designing tables. How would you do it?
What is subquery in sql?
explain different types of constraints? : Sql server database administration