Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

Need help writing 2 Insert Query Scripts in SQL Server 2012

Hi Experts,
If I have two tables I need to write insert scripts for in SQL Server 2012, but the second table's has a foreign key field which is the Auto Generated ID of the first table, how would I write my scripts? Is there an easy way of doing this?


Thanks in advance,
mrotor
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Give us a data mockup of the set you're trying to import plus the schema of these two tables.  
Kinda hard to give an answer otherwise.
Avatar of mainrotor
mainrotor

ASKER

I hope the image below helps illustrate what it is that I am trying to accomplish:

User generated image

Thanks in advance,
mrotor
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Pawan.  
I will try your suggestion, but it looks like it should work just by looking at it.

mrotor