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 |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2007-08-14 : 23:13:58
|
| i have a source table : enrollmentenrollment_keyUnique_idgenderDOBepisod1episod2episod3raceI need to create a process that will insert records in enrollment table to registration and episod table( these two table has foreigen key relationship)registration tableenrollment_key in enrollment table will be the primary key of registration table:registration_keyregistration_key (pk)unique_idgenderDOBand episod tableepisod_keyregistration_key (FK)episod1episod2episod3racewhat is the best process to insert the records from enrollment table to registration and epiosd table? |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-14 : 23:20:53
|
| Tried this?insert into tab_name1 (col list) select col list from tab_name2 where ... |
 |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2007-08-14 : 23:45:14
|
| i am not quite sue your solution will work this case,,how can i make the entry to two tables at the sme time..which has a foreign key relationship.dffernet columns in each row need to go to two different tables |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-14 : 23:46:07
|
| You have to do 2 separate INSERTS. Insert into the child table first followed by the parent table.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|