"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> I need help in generating a unique integer for the table's primary key. I am
> more familiar with MS Access that has a data type called "Autonum" that
> generates the integer. Do I need to find the last record to know what the
> next number should be?

In SQLite, if you declare a column as INTEGER PRIMARY KEY and insert NULL into
that column, a unique value will be automagically inserted in that column for
you.  The value may be the "next" unused value, or could also be a
currently-unused value due to a "hole" in the sequence (perhaps because you
deleted a record).  If you need to guarantee that each new value is always the
next in a continuous sequence,you can use INTEGER PRIMARY KEY AUTOINCREMENT
instead of INTEGER PRIMARY KEY.

Derrell

Reply via email to