Delete duplicate rows from a table without primary key by
using a single query
Table Employee
empname salary
A 200
B 300
A 200
C 400
D 500
D 500

Output should be

A 200
B 300
C 400
D 500

Answer Posted / gaurav sharma

SELECT DISTINCT * INTO Employee1 FROM Employee
DROP Table Employee
sp_rename 'Employee1','Employee'

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens to a statement batch if there is a compilation error?

515


What is mapping schema?

586


What is an sql server agent?

551


What are click through reports?

99


Explain the difference between control flow and data flow?

532






Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture

548


What stored by the master?

549


How to check parameter value in stored procedure sql server?

469


When would you prefer to have a minimum number of indexes?

509


Describe how to use linked server?

549


What is pessimistic concurrency?

546


What is a constant or literal in ms sql server?

603


How do I view a stored procedure in sql server query?

542


What do you mean by data integrity?

602


What is reportserver and reportservertempdb ?

107