Skip to content Skip to sidebar Skip to footer

Using Trigger To Update Table In Another Database

im using the following trigger to update the user table in another database in mysql 5.0.7 The creation of trigger gives no error but upon updating the user table in the first data

Solution 1:

Could you please check below

AFTER UPDATEON db_test.user  FOREACHROWBEGINUPDATETABLE db_testplus.user
    SET  name = NEW.name

    WHERE id = NEW.id
END;

Solution 2:

Try this;

CREATETRIGGER after_update_user

AFTER UPDATEON db_test.user  FOREACHROWUPDATETABLE db_testplus.user
  SET  name = NEW.name
  WHERE id = NEW.id;

Omitting begin-end keywords worked for me.

Solution 3:

This works for me in MySQL 5.1.73:

CREATETRIGGER `after_update`
AFTER UPDATEON `test_table`
FOREACHROWUPDATE another_db.updated_table
SET  some_name = NEW.some_name
WHERE id = NEW.id

Post a Comment for "Using Trigger To Update Table In Another Database"