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 the purpose of the model database?

1023


What are the different types of backups avaialabe in sql server 2005?

1026


What is it’s similarity with sql server?

160


How do I setup a sql server database?

1082


What are secondary xml indexes?

1033


What is normalization and its types?

1042


How can you list all the columns in a database?

938


Can we perform backup restore operation on tempdb? : sql server database administration

1007


What is an indexed view?

968


What are the basic functions for master, msdb, model, tempdb databases?

1050


What is a data source file?

981


What are cursors and when they are useful?

1097


What structure can you implement for the database to speed up table reads?

1209


How important do you consider cursors or while loops for a transactional database?

975


What is named calculation? : sql server analysis services, ssas

989