0

according to this trigger example

I can use trigger to write to other files for audting trails. How do I exactly do that?

I have tried this to no avail

CREATE TRIGGER log AFTER INSERT ON my_table
BEGIN
ATTACH DATABASE /location/otherfile AS logDb
Insert ..

I tried the above code the sqlite console and got the syntax error near ATTACH. How else can I do this?

Thanks!

1 Answers1

1

Inside a trigger body, only INSERT/UPDATE/DELETE/SELECT statements are allowed, and you cannot access other database schemas.

To access other files, you have to create a user-defined function, which requires support from any application that modifies the database.

CL.
  • 173,858
  • 17
  • 217
  • 259