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

Where are sql server user names and passwords stored in sql server?

1093


What are the advantages of sql azure?

140


How do I find the sql server instance name?

969


How do I edit a procedure in sql server?

958


What are the events recorded in a transaction log?

1000


What is the difference between NOROW and LOCKROW?

2840


What are subqueries in sql server? Explain its properties.

1019


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

1148


What do you mean by table and field in sql?

1015


What are different types of subquery?

1245


Due to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?

1327


Beginning with sql server version 7 0, a new enhanced data type nchar was added what type of data is supported with this data type?

1011


Explain linked server in sql?

1225


How do you manipulate data?

910


What are examples of triggers?

1088