mysql create a trigger in a database listening to table changes in a different database
By : user2265066
Date : March 29 2020, 07:55 AM
hope this fix your issue The trigger needs to be in the same schema as the table you are inserting to, but it can access tables in other schemas. Using your example: code :
CREATE TRIGGER schema2.triggername
AFTER INSERT ON schema2.the_table
FOR EACH ROW
INSERT INTO schema1.the_table values (...);
|
How Do I create a trigger on a table that insert into another database
By : user3366737
Date : March 29 2020, 07:55 AM
I hope this helps . I have two mySQL db's on called home and the other called zenphoto_live. , Specify a full name for the trigger, e.g. - code :
CREATE DEFINER = CURRENT_USER TRIGGER zephoto_live.new_images AFTER INSERT ON
...
USE zephoto_live;
CREATE DEFINER = CURRENT_USER TRIGGER new_images AFTER INSERT ON
...
|
How to create a database user and grant it permission to create trigger for specific table only
By : banut
Date : March 29 2020, 07:55 AM
help you fix your problem I'm testing my project and I have to write permissions unit test for one of its components. Unit tests start from creating temporary database and table. I want to write SQL code which creates new user for temporary database and grants it permission to create trigger (single function which component does) just only for temp test table. This user will be used by my component. How can I do this? Any help appreciated. , Try this SQL code. It works for me: code :
USE [YourDatabase];
CREATE USER YourUser FOR LOGIN YourLogin;
GRANT ALTER ON dbo.YourTable TO [YourUser]
|
How to create a trigger to populate a table from another table in a different database
By : Xpl0s01v3DyN0M173
Date : March 29 2020, 07:55 AM
I wish this helpful for you I am unclear about the logic in your selection but if you want to save a copy of what was just inserted into table1 into a table (table2) on another database, using a trigger, you can try this: code :
create trigger trig1 on dbo.table1
after insert as
insert into database2.dbo.table2 (col1,col2,col3) values (inserted.col1, inserted.col2)`
|
Create a trigger TR1 for INSERT, DELETE triggering event where trigger should be fired if the transactions are performed
By : Davies
Date : March 29 2020, 07:55 AM
|