Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: Federate Server Triggers for Insert and Update

    Hi All,

    I need help/suggestion on creating trigger on federated server.

    Issue:

    I have 2 databases in different servers(db2). I need a trigger whenever TABLE1 in DB1 is inserted I need the same to be inserted in TABLE2 in DB2. I have created nickname for the TABLE2 of DB2 in DB1 but I couldn't create a trigger for inserting record through nickname.

    My trigger is kinda:

    CREATE TRIGGER test_insert AFTER INSERT ON TABLE1 REFERENCING NEW AS insertrow FOR EACH ROW MODE DB2SQL BEGIN ATOMIC INSERT INTO nickname.TABLE2 (name1) VALUES (insertrow.name); END

    while creating trigger it is showing error as : Operation not allowed for the federated environment reason code 21 , 22.

    Please help me in making it out by trigger or through any other way.


    Regards
    Michael

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Create a view that cover just the federated table nickname. Then insert into the view.

    Andy

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Hi Andy,

    Thanks for your quick response.

    Do you want to create a VIEW for the nickname(table) created and through trigger insert into the VIEW which will actually insert into the table in another DB.

    Is it possible to insert into VIEW through trigger ?


    Regards
    Michael

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Yes, that is correct.

    Andy

Posting Permissions

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