Write a query to delete duplicate records in SQL SERVER
Answer Posted / prasant ojha
create a table tbl_info
(
name varchar(250),
age int
)
Enter values
'RAM',25
'SHYAM',34
'RAM',25
'GHANSHYAM',25
'RAM',25
//SQL QUERY TO REMOVE DUPLICATE RECORDS WITHOUR ANY KEY
with info_tbl as(
SELECT *,row_number() over(partition by name order by name)
as record_no from tbl_info
)
delete from info_tbl where record_no>1
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
When should you use an instead of trigger?
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
How can you append an identity column to a temporary table?
Where can you add custom error messages to sql server?
How do I find the sql server version?
Why should you use or avoid select * statements?
How do I start sql server 2017?
What is a coalesce function?
What is the difference between upgrade and migration in sql server?
What are the different SQL Server Versions you have worked on?
Why we use the openxml clause?
What is self contained sub query?
What is acid mean in sql server?
Is it possible to have clustered index on separate drive from original table location?
what is the Ticketing tool used in Wipro technologies at Bangalore...???