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
Tell me what is a linked server?
1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?
State the difference between local and global temporary tables?
Does group by or order by come first?
Explain why variables called the most powerful component of ssis?
What is the difference between substr and charindex in the sql server?
What are the approximate numeric data types?
What is the default value of an integer data type in sql server 2005?
Define inner join in sql server joins?
Explain transaction isolation levels in sql server?
What are distinctive joins find as a part of sql?
What is the difference between composite index and covering index?
Why use sub query in sql server and list out types of sub queries?
why would you call update statistics? : Sql server database administration
If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?