Hello Andre,

I'd probably add a single table that does nothing but, supply
auto-increment values to the other tables. You'd only have
"autoincrement" in this one table then when you need a unique number,
insert into the link table, get the rowid/autoincrement value and then
use this value for the link in the other tables you're adding data
too.

In these other tables, the link value might be "primary key" but, not
"autoincrement".

C


Monday, July 2, 2007, 12:36:02 PM, you wrote:

AdP> Good day everyone.

AdP>  

AdP> I would like to know how to create an Autoincrement field and insure
AdP> that it is unique across the database, I tested this and it does not
AdP> seem to work:

AdP>  

c:\Temp>>sqlite3 temp.db

AdP> SQLite version 3.3.17

AdP> Enter ".help" for instructions

sqlite>> create table temptable (id integer primary key autoincrement,
AdP> info text)

AdP> ;

sqlite>> create table temptable2 (id integer primary key autoincrement,
AdP> info text

AdP> );

sqlite>> insert into temptable (info) values ('info1');

sqlite>> insert into temptable2 (info) values ('info2');

sqlite>> select * from temptable;

AdP> 1|info1

sqlite>> select * from temptable2;

AdP> 1|info2

sqlite>>

AdP>  

AdP> as you can see both have id = 1

AdP>  

AdP> I need this because I need a link table that wont know which table the
AdP> id comes from, and I cant add all the fields to make a compound key as
AdP> some of the values would then be blank.

AdP>  

AdP> Any suggestions is greatly appreciated.




-- 
Best regards,
 Teg                            mailto:[EMAIL PROTECTED]


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to