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 a ddl statement?
Explain the etl (extraction, transformation, and loading)?
In how many ways you can invoke ssrs reports?
How to create a new schema in a database?
What is meant by indexing files?
What is a cube? : sql server analysis services, ssas
What is difference between drop truncate and delete?
What happens when converting big values to numeric data types?
How do I clean up sql server transaction log?
How to drop existing views from a database in ms sql server?
Is it possible to create trigger on views?
How to test values returned by a subquery with the in operator?
Why use triggers?
How to change server name in sql server?
How to list all dsn entries on your local machine using odbc_data_source()?