August 14, 2008 at 3:26 pm
I have 2 tables, joined on a key.
I want to insert data into 1 table, and then insert multiple values into the second table using the auto number that was assigned to the first one. In otherwords table1 has an autonumber field that is its primary key and this field is linked to table2.
I can insert into the first one easily enough, but how do i get to insert the same autonumber and the corresponding fields in the second table.
August 14, 2008 at 3:48 pm
If you're doing this in a stored procedure, and the key column of table 1 is an identity, then you can use the SCOPE_IDENTITY() function right after the INSERT INTO Table1 to find out what the value of the key column for the record you just inserted was.
August 15, 2008 at 8:42 am
I am not using stored procedure. Is it possible to do it without using a stored procedure?
Thnx,
Swetha
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply