what about creating a transaction, inserting the order, and in the transaction, asking for ... select <@literal @@identity> .. to get the order's record number? You're not going to get the same unique ID for two orders coming in at the same time.

On Feb 11, 2007, at 12:26 PM, Robert Garcia wrote:

Do not make the mistake of doing an insert, and asking for the last ID doing something like select max(rowid) from table. This works, but it is NOT full proof. If there are 2 orders happening at the same time, you can get the wrong value, and have 2 sessions pointing to the same order. So, create a GUID (guaranteed unique identifier) and either use that as the order key, or use it to retrieve the order id if you want to use the nice integer id.



________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to