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 index in an assignment?
What are different types of data sources?
Explain the difference between control flow and data flow?
What is database architecture? : SQL Server Architecture
How to enter binary string literals in ms sql server?
Distinguish between commit and rollback?
When you should use a low fill factor?
How to select some specific columns from a table in a query in ms sql server?
What are the properties of sub-query?
How to retrieve error messages using mssql_get_last_message()?
How to stop a loop early with break statements in ms sql server?
What is sub-query in sql server? Explain its properties.
Why people hate cursor?
Explain what is sql server english query?
What is an indice?