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 are the differences between decimal and float in ms sql server?

558


Describe how to use linked server?

535


What is cursor in ms sql server?

553


what stored procedure can you use to display the current processes? : Sql server administration

525


What is the difference between osql and query analyzer?

539






What is a synonym for manipulation?

533


What do you understand by check constraint in sql server?

474


Can sql servers link to other servers like oracle?

459


What the different types of Replication and why are they used?

538


can an order by clause be used in a creation of a view?

686


Where are sql server usernames and passwords stored in the sql server?

605


How many types of stored procedures are there in sql server?

547


How many levels of sp nesting is possible?

575


What are the main sources of data?

584


How many replicas are maintained for each sql azure db?

104