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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 simultanious insert into Parent and multiple children

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-15 : 09:23:15
Maurice writes "I need some help regarding SQL. Here's the situation.

I have 3 tables:

tblShop , tblJoin , tblCategory

I have a many to many relation between "tblShop" and "tblCategory". It's built with the help of "tblJoin".

tblShop (1) - tblJoin (m)
tblCategory (1) - tblJoin (m)

Now I want to insert a record into "tblShop", and AT THE SAME TIME, insert multiple (related to tblShop) records into "tblJoin". (tblCategory is just a "lookup table".)

The problem is that I don't know the value of the primary key from tblShop when i want to insert the info into tblJoin.

How can that be done? I have spent quite a bit of time trying to figure it out. No success.


Thanks in advance for your input.

Maurice"
   

- Advertisement -