adspace
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
what is the difference between openrowset and openquery?
Does view occupy space?
How raid can influence database performance?
What is the primary use of the model database?
What is in place upgrade in sql server?
Can sql servers link to other servers like oracle?
What is acid mean in sql server?
How do I find query history in sql server?
How do I start sql server 2017?
How to convert character strings into numeric values?
what is spatial nonclustered index
What is normalization and what are the advantages of it?
Why use identity in sql server?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
Why should you use or avoid select * statements?