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 sql server english query?
What is replication with database mirroring? : sql server database administration
Explain about nested stored procedure?
what happens on checkpoint? : Sql server database administration
can we have a nested transaction? : Sql server database administration
Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?
when you create a database how is it stored? : Sql server database administration
What is difference between foreign key and unique key?
What is a trigger in sql server?
Explain what is the difference between a local and a global temporary table?
Why we need to use secondry database file? though, we can do same work using primary database file also.
What is difference between materialized view and view?
How to create nested stored procedure?
Scalability, Availability, Integration with internet, etc.)?
How to use go command in "sqlcmd"?