Instead of REFERENCES staff(id) Try REFERENCES staff_01(id) That spelling thing will get you every time...:-) Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems
________________________________ From: sqlite-users-boun...@sqlite.org on behalf of Oliver Peters Sent: Mon 8/9/2010 7:46 AM To: sqlite-users@sqlite.org Subject: EXTERNAL:[sqlite] foreign key error 01 Hello environment ----------- OS : Win XP (every patch) sqlite : 3.7.0.1 reproduction ------------ CREATE TABLE staff_01( id INTEGER PRIMARY KEY AUTOINCREMENT, id_staff_editor INTEGER NOT NULL, code CHAR(2) NOT NULL, FOREIGN KEY(id_staff_editor) REFERENCES staff(id) ); INSERT INTO staff_01(id_staff_editor,code) VALUES(1,'CB'); PRAGMA foreign_keys = ON; CREATE TABLE staff_02( id INTEGER PRIMARY KEY AUTOINCREMENT, id_staff_editor INTEGER NOT NULL, code CHAR(2) NOT NULL, FOREIGN KEY(id_staff_editor) REFERENCES staff(id) ); INSERT INTO staff_02(id_staff_editor,code) VALUES(1,'CB'); For the last insert I get: "Error: near line 20: no such table: main.staff" Greetings Oliver _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users