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
Do you know hot add cpu in sql server 2008?
What is SQL Azure?
What are the advantages of passing name-value pairs as parameters?
How can we get count of the number of records in a table?
What is the difference between seek predicate and predicate?
Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?
How to create a view using data from another view?
How to change the password of a login name in ms sql server?
What is data modification?
Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
List down some advantages of sql stored procedure?
What is the fastest way to permanently delete a 1 million row table named customers?
Explain the difference between function and stored procedure?
What is difference between primary key and foreign key?
You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?