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...

How To delete duplicate record from a particular table?

Answer Posted / kala suresh

--BY USING A TEMP TABLE TO DELETE DUPLICATE ROWS OF A TABLE
WITH OUT A PRIMARY KEY COLUMN OR AN IDENTITY COLUMN

SELECT Name, age, ROW_NUMBER() OVER(ORDER BY age) AS
'RowNumber' into #temp1 FROM RowNumber

delete from #temp1 where rownumber not in(select
max(rownumber) from #temp1 group by name,age)

delete from rownumber

select * from #temp1 into rownumber

drop table #temp1


--BY USING AN IDENTITY COLUMN TO DELETE DUPLICATE ROWS OF A
--TABLE WITH OUT A PRIMARY KEY COLUMN

delete from rownumber where id not in(select min(id) from
rownumber group by name,age)
select * from rownumber

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain differentiate between a having clause and a where clause?

851


What is a select query statement in ms sql server?

1006


What is rolap and its advantage? : sql server analysis services, ssas

1218


What are the triggers in sql?

1017


What are the approximate numeric data types?

875


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?

962


What do you understand by integration services in sql server?

919


What does top operator do?

962


How to truncate the log in sql server 2012? : sql server database administration

1199


How to insert multiple rows with one insert statement in ms sql server?

1054


What is subquery in sql?

986


Give an example of SQL injection attack ?

928


What is the purpose of the model database?

962


What are logical database components? : SQL Server Architecture

958


What is application role in sql server database security? : sql server security

992