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 attribute? : sql server analysis services, ssas
What is a database in ms sql server?
What is difference between rownum and rowid?
What is a covering index?
What is normalization? Explain different forms of normalization?
Why is the need for data conversion transformations?
What is 1nf normalization form?
How much memory that we are using in Logshipping Concept?
How to configure and test odbc dsn settings?
When does the auto update index statistics feature in sql server turn itself on?q) what specific conditions database should meet, before you can bulk copy data into it using bcp?
explain the storage models of olap? : Sql server database administration
What is temporary table in sql server? Why we use temp table?
What is normalization and denormalization in sql server?
Explain “row_number()” in sql server with an example?
Where can you find the error log information? : sql server database administration