How can i create a foreign key value in the child table for every primary key value created?
Posted on 2004-08-17
If I have an insert stored procedure like say;
CREATE PROC procTest
@Title varchar(4)= [NOT NULL],
@FirstName varchar(15)= [NOT NULL],
@LastName varchar(25)= [NOT NULL],
@Branch varchar(28)= [NOT NULL]
INSERT INTO tblTest(Title,FirstName,LastName,Branch)
How can I modify this code so that it retrieves the new identity value and writes this into another table as the foreign key
In other words when sql server creates a new primary key value how can I create the appropriate foreign key in the child table?