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 is the purpose of the model database?
What are the different types of backups avaialabe in sql server 2005?
What is it’s similarity with sql server?
How do I setup a sql server database?
What are secondary xml indexes?
What is normalization and its types?
How can you list all the columns in a database?
Can we perform backup restore operation on tempdb? : sql server database administration
What is an indexed view?
What are the basic functions for master, msdb, model, tempdb databases?
What is a data source file?
What are cursors and when they are useful?
What structure can you implement for the database to speed up table reads?
How important do you consider cursors or while loops for a transactional database?
What is named calculation? : sql server analysis services, ssas