That could work, but it is extra work, just hoped it was available,
would make life easier, and not need extra columns in an already very
large link table, and also extra conditions in the select.

But if there is no other way I'll go this route.

I guess one nice feature that they may consider for a future version of
sqlite is generators as in interbase, and then the ability to query and
set their values.


But thank you for the suggestion.

-----Original Message-----
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: 02 July 2007 06:53 PM
To: SQLite
Subject: [sqlite] Re: Database Level Unique Sequence

Andre du Plessis <[EMAIL PROTECTED]> wrote:
> 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:
>
> 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.

I don't understand this last statement. What again prevents you from 
having a table like this:

create table linkTable (infoId integer, inWhichTable integer, ...);

You can also play arithmetic tricks, like adding a large constant to all

IDs that come from temptable2 when storing them in linkTable.

If you insist on having non-repeating IDs through both tables, you can 
write a set of triggers to achieve that.

Igor Tandetnik 


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


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

Reply via email to