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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-12-07 : 13:15:50
|
| Rajesh S writes "Hi , I would like to have a single SQL Statement to delete duplicate employees from the employee table.Thanks,Rajesh S" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-07 : 13:18:16
|
| Try searching in google for"sql server" delete duplicatesyou will find http://www.sqlteam.com/item.asp?ItemID=3331==========================================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. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-12-07 : 13:27:38
|
You didn't use the just friggin' google it site. Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-07 : 13:55:55
|
| oops - your memory goes when you get to my age.==========================================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. |
 |
|
|
AlDragon
Starting Member
12 Posts |
Posted - 2004-12-07 : 16:04:29
|
quote: Originally posted by AskSQLTeam Rajesh S writes "Hi , I would like to have a single SQL Statement to delete duplicate employees from the employee table.Thanks,Rajesh S"
If you add an identity field firstAlter table TableDeleteadd integer identitiygoDo a select to see what you will deleteThen statement to followDelete T1From TableDelete T1Inner join TableDelete T2On matching fieldsWhere T1.Ident < T2.IdentDrop the ident if you dont want itAlter table TableDeletedrop column IdentgoAl Franzini |
 |
|
|
|
|
|