Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Unanswered: Pls Help..Triggers

    Hi

    I did not create any SQL trigger or procedure before. What I need is that I have 6 tables as:
    1- Parent1 [Employee]: EmpID (PK), EmpName ...etc.
    2- Child1 [EmpCourse]: EmpID (FK), CourseName, ...etc
    3- Child2 [EmpExperience]: EmpID (FK), ExperienceSource, ...etc.

    4- CopyofParent1 [Employee]: EmpID (PK), EmpName ...etc.
    5- CopyofChild1 [EmpCourse]: EmpID (FK), CourseName, ...etc
    6- CopyofChild2 [EmpExperience]: EmpID (FK), ExperienceSource, ...etc.


    CopyofParent1 columns is superset of Parent1 columns.
    Similarly for CopyofChild1 and CopyofChild2.

    As soon as a record in Parent1 is inserted and meets a certain criterion, the record shd be inserted in CopyofParent1 using EmpID .
    At this time, records from Child1 and Child2 for the same Parent shd be inserted in CopyofChild1 and CopyofChild2 resp.


    Please help.

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4

  3. #3
    Join Date
    Nov 2008
    Posts
    16
    Thanks LittleFoot for the doc.

    I guess I omitted mentioning arent-child relationship triggers".
    I have already created a trigger to insert record in CopyofParent1 as soon as record is inserted in Parent1 table.

    But I'm not able to figure out how to pick child records for this parent and insert in their respective child tables.

    Pls Help.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Children should have a foreign key (a single column or even a composite key) which connects them to their parents.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •