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
Which are ddl commands?
Explain microsoft sql server functions?
How to use wildcard characters in like operations in ms sql server?
How to find related tables in sql server?
What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas
How to create stored procedures with parameters in ms sql server?
Explain different types of collation sensitivity?
Explain “row_number()” in sql server with an example?
What is the advantage of sql server?
Can we make the the chages By Using the Sql if u know any function or process please inform me Actuall result: BRK1 Break 1 Part 1 00:01:00:00 60 BRK1 Break 1 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 BRK2 Break 2 Part 2 00:01:00:00 60 BRK2 Break 2 Part 3 00:01:00:00 60 BRK3 Break 3 Part 1 00:01:00:00 60 BRK3 Break 3 Part 2 00:01:00:00 60 Desired O/P: BRK1 Break 1 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 Part 3 00:01:00:00 60
List the advantages of using stored procedures?
What different steps will a sql server developer take to secure sql server?
What is the report builder?
Explain primary key and foreign key constraints?
How do I open a .db file?