After Insert-Trigger -> insert into another data base possible?

megadyn's profile image megadyn posted 4 years ago in Import/Export Permalink

Hello,

I want to insert new data sets of my table "order" into another database (table "order2") if it fits some criteria. Is it possible to do something like this in HeidiSQL?

As you might see, I am new to this :) I created a new trigger and wrote the following:

*ON After insert BEGIN

INSERT IGNORE into NEW_DB.acquired_data.order2 values (SELECT TOP (1) * from THIS_DB.acquired_data.order where product in ('someting','something else') order by date desc)

END*

I am not quite sure if I use the syntax of the trigger function correctly. I immediately get an error in Line 1 at "BEGIN" :-\

Any hint would be helpful!

Thanks a lot!

megadyn's profile image megadyn posted 4 years ago Permalink

I also tried an easier approach: Just copying the new row into another table. But still, I get an error and don't know what to do. Here is my code so far:

ON after insert BEGIN

INSERT IGNORE into aqcuired_data.order2 values (SELECT TOP (1) * from acquired_data.order where product in (list of products) order by date desc)

END

Thanks for any help!

Please login to leave a reply, or register at first.