Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is sql server english query?

1111


What is replication with database mirroring? : sql server database administration

1065


Explain about nested stored procedure?

1020


what happens on checkpoint? : Sql server database administration

1088


can we have a nested transaction? : Sql server database administration

1077


Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?

952


when you create a database how is it stored? : Sql server database administration

1009


What is difference between foreign key and unique key?

1003


What is a trigger in sql server?

1160


Explain what is the difference between a local and a global temporary table?

989


Why we need to use secondry database file? though, we can do same work using primary database file also.

6866


What is difference between materialized view and view?

905


How to create nested stored procedure?

1008


Scalability, Availability, Integration with internet, etc.)?

2873


How to use go command in "sqlcmd"?

1195