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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2006-05-15 : 15:28:27
|
| How to code to insert from tableA to tableB and get rid of duplicated records in tableA? For example, I set up OrderID as primary key in tableB and used code bellow but failed:insert into tableB select * from tableA |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-15 : 15:33:25
|
| insert into tableB Bselect * from tableA A where A.OrderID not in (select B.OrderID from tableB B)Srinika |
 |
|
|
richardn
Starting Member
3 Posts |
Posted - 2006-05-16 : 09:22:32
|
Hi, I have the same problem, but the primary key is composed from two fields (like UserID and DateOfCall). What should be the WHERE statement and the statement after "not in"Thanks,Richardquote: Originally posted by Srinika insert into tableB Bselect * from tableA A where A.OrderID not in (select B.OrderID from tableB B)Srinika
|
 |
|
|
|
|
|