I have a table EMP in which the values will be like this
EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30
I want to delete only duplicate Rows. After Delete I want
the output like this
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30
Answer Posted / kishor kumar
This can be solved by 2 Ways
One way
Create unique index on this Table with ignore duplicate row
2nd way.
1st transfer the data to a temp table bu using Distinct
clause then truncate the EMP table and then transfor the
data from temp table to EMP Table.
select distinct (column names) in to #temp from EMP
Truncate table EMP
INSERT INTO EMP
SELECT * FROM #temp
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
How to identify current user in ssrs report?
What is an identity column in insert statements?
Suppose you want to implement the one-to-many relationships while designing tables. How would you do it?
Does partitioning ssd reduce performance?
How many types of local tables are there in sql server?
How we create SQL Server 2005 Reporting Services ? Give me Sample
What are the differences between union, intersect, and minus operators?
Does sql server use java?
How to use order by with union operators in ms sql server?
How to connect Azure federated root database and apply federation in entity framework?
Why truncate is ddl?
Does partitioning improve performance sql server?
What is the difference between varchar and nvarchar datatypes?
How to enable/disable indexes?
Explain concepts of analysis services?