Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Recife - PE - Brazil
    Posts
    28

    Unhappy Unanswered: TRIGGER for two tables.

    Hi,

    I have two tables TB1 and TB2 that has a relationship 1:1 with the colum ID_Produto where I would like to make a trigger where
    When I Insert a new record into TB1 the same value for ID_Produto from the TB1 table be inserted into ID_Produto from the TB2
    Everything I´ve done give wrong....Somebody can help to create this trigger.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    If the cardinality is 1:1, why not make it one Table?

    Why store redundant info


    In any case...

    CREATE TRIGGER myTrigger ON TB1 FOR INSERT --Do you care about updates
    AS

    INSERT INTO TB2 FROM inserted
    GO

    PLEASE MAKE IT ONE TABLE!
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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