Hi, ALL,
I believe the creation a foreign key on the existing tables is not supported
on SQLite.

However, I can issue a series of the SQL command which will emulate
the creation of foreign key.

1. BEGIN
2. CREATE TEMPORARY TABLE temp AS SELECT * FROM <fkTable>;
3. DROP TABLE <fkTabke>;
4. CREATE TABLE <fkTable>(, FOREIGN KEY() REFERENCE pkTable() ) AS
SELECT * FROM temp;
5. DROP TABLE temp;
6. COMMIT;

My questions are:
1. On step 3 all ttriggers and indexes will be dropped as well, right?
2. If yes - what would be the best way to read them and apply to the step 4?

Thank you.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to