At 7:02 AM +0200 6/24/04, Aviram wrote:
Hi,
I'm trying to run the following SQL commands:
        CREATE TABLE T_ORDERS(OrderID INTEGER PRIMARY KEY);
        BEGIN TRANSACTION;
                INSERT INTO T_ORDERS (OrderID) Values (NULL);
                Select max(OrderID) from T_ORDERS;
        COMMIT TRANSACTION;
each command in executed separately, can I be sure that the value I get from
the select max() is unique ?
Best Regards,
Aviram Gilboa

I think that as long as SQLite's primary key autonumber will always generate a unique value over the life of the table, and will not re-use ids that were deleted previously, then your use of max() in that context should always be unique. But I don't know about this part of SQLite's internals, so I can't answer your question absolutely. This said, don't you actually want some last_insert_id() type of function? If you use that sort of thing, then it won't matter if numbers are reused or not. -- Darren Duncan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to