Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
asifbhura
Posting Yak Master
165 Posts |
Posted - 2006-07-18 : 08:40:40
|
| dearI want to delete duplicates rows from my tablewaiting for reply.regards,ASIF |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-18 : 08:44:13
|
| You mean if there is a duplicate then delete them all leaving none of those rows?delete tblfrom tbl t1join (select col1, col2, col3, ... from tbl group by col1, col2, col3, ... having count(*) > 1) t2on t1.col1 = t2.col1and t1.col2 = t2.col2and t1.col3 = t2.col3...You would also have to deal with nulls if you have them==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-07-18 : 09:01:21
|
quote: Originally posted by asifbhura I want to delete duplicates rows from my table
Add an identity column to the table, delete unwanted rows based on identity value and then remove Identity column from the table.Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-18 : 10:44:12
|
| Here's a related link - including an example of the method Harsh suggests...http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69173Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|