Home Forums Database Design Relational Theory How to Add Parent Table Record Id in Child Table Using Foreign Key RE: How to Add Parent Table Record Id in Child Table Using Foreign Key

  • Gopal Singh (4/26/2012)


    Hello,

    I have one parent & child table and i have make relation ship using a foreign key. Primary key in parent table is forein key in child table.

    So want when i enter records in primary table, the id of each records automatically goes in to child table.

    how can i do this?

    waiting your reply....

    Regards,

    Gopal Singh

    What is inserting the data into the Parent table? If a stored procedure, you can add the additional insert into the Child there.

    If it is a direct table insert into the Parent then you can achieve the desired result by implementing an AFTER INSERT TRIGGER on the Parent table that will insert rows into the Child after rows are inserted into the Parent.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato