copy an identity column into another table

Posted by slake on Stack Overflow See other posts from Stack Overflow or by slake
Published on 2009-06-27T22:59:59Z Indexed on 2010/04/24 20:43 UTC
Read the original article Hit count: 136

Filed under:
|
|

I have 2 tables that are related,both have identity columns for primary keys and i am using a vb form to insert data into them,My problem is that i cannot get the child table to get the primary key of the parent table and use this as its foreign key in my database. the data is inserted fine though no foreign key constraint is made.I am wondering if a trigger will do it and if so how. All my inserting of data is done in vb.

The user wont insert any keys. all these are identity columns that are auto generated. If a trigger is my way out please illustrate with an example.

If there is another way i can do this in VB itself then please advise and an example will be greatly appreciated

Thanks in advance

© Stack Overflow or respective owner

Related posts about autoincrement

Related posts about vb.net