Hello all,

Is it possible to create a trigger on an attached database? I can't seem
to, so I was wondering whether my trigger SQL is wrong (although it
works if I remove the attached database's name from the table).

The only other way that I see to do what I need would be to create
temporary tables in the main database, copy data there, then update it
and then copy that data to the destination tables...

Maybe there's a different way to do this, can someone please advise me
if there's a better way to accomplish the following:

In a simple scenario, I have 2 tables, data in one of them depends on
the other:

CREATE TABLE table1 ( ID INTEGER PRIMARY KEY, Name);
CREATE TABLE table2 ( ID INTEGER PRIMARY KEY, NameID);

where NameID in table 2 == ID in table 1. Almost always table2 has
multiple entries with the same NameID, thus linking a list of items to
one item from table1.

Now, I've extracted this data from the database and saved it as a small
database that I later want to add to another database. When I'll be
inserting items from the small database's table1 into the large
database's table1, the ID in table1 will change, because there'll be
entries with the same ID. At this point I need to update the NameID in
table2 to reflect this change before I insert items from table2 into the
main database. That's where I wanted to use a trigger (I attach the
small database to the main one).

I'll appreciate any thoughts on how best to accomplish this.

Thank you in advance,

   Dennis


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to