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.

Reply via email to