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
Is it possible to have clustered index on separate drive from original table location?
If the job running very slow what is the action you do
How to create new table with "create table" statements?
What are transactions and its controls?
Can you name some of the dml commands in sql?
What are the advantages of mirroring?
What are information schema views?
Can we add our custom code in ssis?
you have separate development and production systems you want to move a copy of a development database into production to do this, you do a backup on the development system and restore to the production system after a few minutes, you begin getting calls from several customers saying that they are denied access to the system why? : Sql server administration
what's sql server? : Sql server database administration
How to create a dml trigger using create trigger statements?
What is user-defined functions? What are the types of user-defined functions that can be created?
What is the purpose of object explorer and its features? : sql server management studio
How will you know when statistics on a table are obsolete?
What is statement level trigger?