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 the xml support sql server extends?

1032


Tell me what are the advantages of using stored procedures?

1000


What purpose does the model database server?

1086


What is Command line parameters in PLSQL.?

1125


How to change the password of a login name in ms sql server?

1008


A trigger can reference objects outside the current database? State true or false.

1001


What to perform pattern match with the like operator?

875


What are the new scripting capabilities of ssms? : sql server management studio

1055


What is importing utility?

978


What is the process of normalization?

1114


what is the information that can be stored inside a bit column? : Sql server database administration

953


Define right outer join?

974


What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?

1069


What program is used to store the data source file?

957


What are null values in ms sql server?

1079