Is it possible to delete duplicate rows in a table without
using a temporary table ?
Answer Posted / kalyan.k
yes,it is possible.
By using row_number function.
dept table contains two columns(eid,ename)
eid dname
1 k
1 j
1 u
2 k
2 j
2 u
with [dept ordered by eid] as
(
select row_number()over(partition by ei order by eid)as
rowid,* from dept
)
delete from [dept ordered by eid] where rowid >1
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Can foreign key be deleted?
What is nolock?
What is public role in sql server?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
Why use update_statistics command in sql server?
What will be the maximum number of indexes per table?
What is a file group?
Do you know what is xpath?
Does index speed up select statements?
List all the types of user-defined functions?
Why functions are used in sql server?
What are “phantom rows”?
How to list all triggers in the database with sys.triggers in ms sql server?
State the difference between union and union all?
Which tcl commands are available on the sql server?