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 retrieve duplicate rows in a table?
How to delete the duplicate entries in a table?

Answer Posted / samba shiva reddy . m

How to retrieve the duplicate rows in table :

select * from emp group by empid,empname having count(empname)>1

How to delete the duplicate rows in table :
1.inserting distinct rows in temp table variable
2. deleting emp table
3.Again inserting into emp table from temp table variable


declare @temp table
(empid int,empname varchar(50))
insert into @temp
select * from emp group by empid,empname having count(empname)>0
delete from emp
insert into emp
select * from @temp
select * from emp

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of attributehierarchyvisible ? : sql server analysis services, ssas

1061


What are Row versions of DataRow?

1015


What does the update command do?

1105


Explain the difference between HTTP and HTTPS in database?

1023


What is the benefit of normalization?

1074


Which rendering formats are affected by the pagesize properties?

144


What are the dmvs? : sql server database administration

1046


What does executeupdate return?

968


What is ems sql management studio? : sql server management studio

1097


What does ss stand for sexually?

1070


Why do we need different type of parameter?

1045


How to connect of datebase with sql express.?

1093


What is ms sql server index?

1089


How to use wildcard characters in like operations in ms sql server?

1127


What are the High-Availability solutions in SQL Server and differentiate them briefly?

1134