Brad,

Sounds like you're using either MS-SQL or Sybase. Either way you don't have 
to run a select after the insert. Both have a built-in variable for 
auto-increment fields (@@identity) and you can either return it in your 
stored procedure or from the next Tango action.

The only problem with doing this in a Tango action is that there is no real 
guarantee that you're seeing the correct identity field. For example, if you 
are using two consecutive Tango actions, you could run into a situation where 
two threads are doing an insert and the first one gets the identity field 
only after the second insert - guess what you're getting for @@identity? 
Yep... ;-) Remember, this has nothing to do with Tango - there is only one 
identity variable and it will always be set ot the last identity field 
inserted.

Klaus

On Tuesday 30 April 2002 08:37, Brad Robertson wrote:
> I am currently using a Direct DBMS action in wTango that calls a stored
> procedure to insert a record and then return the new identity of that
> field, it seems that works better than a insert then search action to get
> the identity field.  I was wondering if 5.0 or later will have the ability
> to grab this field on insert, or if anybody has a less tedious way of doing
> this...
>
> Brad

----------------------------------------
Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: quoted-printable
Content-Description: 
----------------------------------------
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to