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

What are the advantages of sql azure?

140


How many database files are there in sql server 2000?what are they?

1053


What are the character string functions supported by sql server 2005?

1014


How to modify the underlying query of an existing view?

991


What is the purpose of indexing?

1046


What are the properties of the relational tables?

881


1. Tell me your daily activities 2. If sql server installation fails at time installation what will do 3. Where does the sql server installation log details are stored 4. After the installation what will you do for memory configuration 5. What is the difference between SQL max maximum memory and AWE memory 6. How will you configure AWE memory 7. How will setup an email alert for the backup job 8. After the SQL installation what are the jobs will you configure 9. What does –g mean in the sql startup parameter 10. What is the difference between Bulked log and Full recovery model 11. What is the difference between mirroring and log shipping 12. What are the steps to be followed before in-place up gradation 13. After installing the patch the sql server does not start and application team tells to rollback the changes .In this scenario what will you do

2493


How to select an exiting database using mssql_select_db()?

989


What is scan table/view and seek table/view when its occurs? : sql server database administration

1052


Name 3 ways to get an accurate count of the number of records in a table?

1039


What is coalesce in sql server?

1052


What is Service Broker in sql server 2012?

1020


What is abstracting periodical?

946


What is normalization? Explain different forms of normalization?

1160


What is sql server 2000 work load governor?

1065