Re: Collecting the primary key using MAX during an insert

2005-04-21 Thread Dan Rossi
Thanks for your lengthy responses everyone. I ended up using sequences which are available with PEAR MDB2 and DB, so i get the currentID + 1 while inserting, but as you say another entry could have gone in during the process, but this happens during the insert stage. I might have to revert the

Re: Collecting the primary key using MAX during an insert

2005-04-20 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Dan Rossi <[EMAIL PROTECTED]> wrote on 04/20/2005 12:55:45 AM: >> Hi there, I was wondering how its possible to get the MAX of a primary >> key of a table during an insert. I basically want to create a ticket >> number, but use the prim

Re: Collecting the primary key using MAX during an insert

2005-04-20 Thread Michael Stassen
Michael Stassen wrote: (correcting myself) I'm guessing that the prefix ('FAULT' in this case) varies according to the kind of incident, so you want to include it in your table. The best way to do that is to use a separate column (perhaps an ENUM column with the possible values). For example,

Re: Collecting the primary key using MAX during an insert

2005-04-20 Thread Michael Stassen
Dan Rossi wrote: Hi there, I was wondering how its possible to get the MAX of a primary key of a table during an insert. I basically want to create a ticket number, but use the primary key as part of the ticket number ie FAULT-001 or FAULT-0002 . I tried during a sub query on an insert

Re: Collecting the primary key using MAX during an insert

2005-04-20 Thread SGreen
Dan Rossi <[EMAIL PROTECTED]> wrote on 04/20/2005 12:55:45 AM: > Hi there, I was wondering how its possible to get the MAX of a primary > key of a table during an insert. I basically want to create a ticket > number, but use the primary key as part of the ticket number ie > FAULT-001 or FAU