how to delete duplicate rows from table in sql server
Answer Posted / sanjay kumar dinda
Deletion of Rows depends upon the different condition...
Consider based on n columns the entire recordset is
treating a duplicate... We can delete the duplicate by
using following method...
Add one column and set uniue values to that column..
ALTER TABLE TABLE1 ADD ID INT IDENTITY(1,1)
COnsider T contains 40 columns and based on C1,C2,C3 we
have to find the duplicate and we have to delete the same...
Delete T1
FROM TABLE1 T1,TABLE1 T2
WHETE T1.C1=T2.C1 AND
T1.C2=T2.C2 AND
T1.C3=T2.C2
AND T1.ID>T2.ID
I think this will help....
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can we use ConnectorJ JDBC Driver with MS SQL?
What are the different type of replication in sql server?
Explain unique key in sql server?
what is nonclustered index
What is @@error in sql?
Explain transaction server implicit?
your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files? : Sql server administration
Can primary key be a foreign key?
What is the purpose of the model database?
How to test a dml trigger in ms sql server?
What is rtm version in sql server?
what is dbcc? : Sql server database administration
Tell me the use of keyword with encryption. Create a store procedure with encryption?
When would you use it?
In which format does an image save in SQL Server database ?