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
What are the components of sql server service broker?
how can a database be repaired? : Sql server administration
What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio
How to throw custom exception in Stored Procedure?
How to make remote connection in database?
What is the maximum size of sql server database?
Is there any difference between primary key and unique with the not null condition?
What does asynchronous call backs means?
what is unique and xaml nonclustered index
What is reference section?
What is set nocount on?
Explain hostprotectionattribute in sql server 2005?
you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration
What is the difference between a stored procedure and a user defined function?
Define constraints and give an example of their use?