Getting New RecID after SQL INSERT

Frank Schima frank-list2 at mindstarprods.com
Fri Aug 20 08:49:14 CDT 2004


Hi Ruslan,


On Aug 19, 2004, at 5:17 PM, Ruslan Zasukhin wrote:

> On 8/19/04 11:32 PM, "Frank Schima" <frank-list2 at mindstarprods.com> 
> wrote:
>
>> I can't seem to recall if there is a way to get the RecID of a newly
>> INSERTed record using SQL? I'm using V4RB 1.10. I know how to do it
>> with Table methods but I want to use a pure SQL method if possible.
>>
>> I'm sure we'll have this in Valentina 2.
>
> Actually I think we have no yet this feature.
>
> And if I not mistake, ALL dbms I have see, resolve this
> Via API function  get_last_id()
>
> Am I right ?

Usually they have a SQL way to do that. For instance in MySQL it is:

    SELECT LAST_INSERT_ID()

In Sybase, you can use:

    SELECT @@IDENTITY

This ability is especially important for stored procedures.


Best regards.
Frank



More information about the Valentina mailing list