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 |
|
papa_sarr
Starting Member
6 Posts |
Posted - 2011-08-10 : 18:24:31
|
| I am trying to copy some records from Table A to Table B, and if successful delete them from Table A. I use a temp table to save temporary the records to be deleted. My problem is that Tables A and B do not have a primary key. This is the way they were designed and I cannot alter them. My question is that how can I compare the data between the temp table and Table A for the deletion knowing that there are no primary keys and each table has more than 20 columns. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
papa_sarr
Starting Member
6 Posts |
Posted - 2011-08-10 : 20:28:42
|
| Thank you for your response.The rows to copy is based on the records present in the table at the time the copy is being done. Note that there are new records being added to the table A at any moment |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
papa_sarr
Starting Member
6 Posts |
Posted - 2011-08-10 : 20:34:52
|
| Hi Tara,Between my insert and delete, new records are added into the table A. Therefore, I may delete records not yet inserted into Table B.Thank you |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
papa_sarr
Starting Member
6 Posts |
Posted - 2011-08-10 : 21:09:49
|
| There is no set of columns make the row unique, and this is the difficulty. |
 |
|
|
papa_sarr
Starting Member
6 Posts |
Posted - 2011-08-10 : 23:11:18
|
| Table 1 is in the staging server. |
 |
|
|
|
|
|