How to delete the duplicate rows from a table in SQL Server ??
Answer Posted / vnreddy
create table sampletbl(id int,name varchar(100))
insert into sampletbl values(1,'aa')
insert into sampletbl values(1,'aa')
insert into sampletbl values(1,'aa')
insert into sampletbl values(2,'bb')
insert into sampletbl values(2,'bb')
with cte as(
select ROW_NUMBER() over (partition by id order by id) as r_no,* from sampletbl)
delete from cte where r_no>1
select * from sampletbl
Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
Explain different types of self contained sub query?
What are the steps to follow to configure SQL*Net?
Do you think BCNF is better than 2NF & 3NF? Why?
Tell me about the approaches which you used to counter the DI problems.
Tell me what are cursors and when they are useful?
Is BCNF better than 2NF & 3NF? Why?
How to execute a sql statement using mssql_query()?
What is a partition key?
How to use subqueries with the exists operators in ms sql server?
What is sql injection? How to protect against sql injection attack?
What is best institute to Learn DotNET And SQL in chennai?
What is named calculation? : sql server analysis services, ssas
What do you mean by collation recursive stored procedure?
Can two tables have the same primary key?
What are different type of Collation Sensitivity?