http://www.mail-archive.com/sqlite-users@sqlite.org/msg10803.html
Describes a patch that implements a sequence table, and functions to deal with it. You could use something like that to implement a unique-across-all-tables ID scheme. Though I think someone else (Igor?) already suggested something similar. -Clark ----- Original Message ---- From: Andre du Plessis <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Monday, July 2, 2007 9:36:02 AM Subject: [sqlite] Database Level Unique Sequence Good day everyone. I would like to know how to create an Autoincrement field and insure that it is unique across the database, I tested this and it does not seem to work: c:\Temp>sqlite3 temp.db SQLite version 3.3.17 Enter ".help" for instructions sqlite> create table temptable (id integer primary key autoincrement, info text) ; sqlite> create table temptable2 (id integer primary key autoincrement, info text ); sqlite> insert into temptable (info) values ('info1'); sqlite> insert into temptable2 (info) values ('info2'); sqlite> select * from temptable; 1|info1 sqlite> select * from temptable2; 1|info2 sqlite> as you can see both have id = 1 I need this because I need a link table that wont know which table the id comes from, and I cant add all the fields to make a compound key as some of the values would then be blank. Any suggestions is greatly appreciated. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------