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
Explain trigger and its types?
How secure is sql server database?
What is dynamic cursor in SQL SERVER?
What is the difference between count and distinct count?
What is difference between delete & truncate commands?
What is exclusive locks?
What is a DBMS, query, SQL?
What’s the distinction between dropping a info and taking a info offline?
What is the difference between DATETIME2 and DATETIME?
what is normalization? Explain different levels of normalization? : Sql server database administration
How will you know when statistics on a table are obsolete?
What do you mean by tablesample?
What are orphan records?
Explain DBCC?
How many types of keys are there?