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
What is the use of attributehierarchyvisible ? : sql server analysis services, ssas
What are Row versions of DataRow?
What does the update command do?
Explain the difference between HTTP and HTTPS in database?
What is the benefit of normalization?
Which rendering formats are affected by the pagesize properties?
What are the dmvs? : sql server database administration
What does executeupdate return?
What is ems sql management studio? : sql server management studio
What does ss stand for sexually?
Why do we need different type of parameter?
How to connect of datebase with sql express.?
What is ms sql server index?
How to use wildcard characters in like operations in ms sql server?
What are the High-Availability solutions in SQL Server and differentiate them briefly?