Thanks Razzak!

I didn't know about the count=insert.

Do you know if this technique would work in r:tango too through oterro?

I just want to make sure it works even when there could be overlapping
requests so that we don't have a "collision" and get the wrong id returned
for one of the requests.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of A. Razzak
Memon
Sent: Wednesday, April 19, 2006 11:23 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: last inserted id

At 01:50 PM 4/19/2006, Alan Wolfe wrote:

>I was wondering if there was a way to where if you insert a
>row into a table with an auto incremented column to get the
>last id# inserted?

Alan,

Here's how:

Use the following technique right after
the insert command.

-- start
SET VAR vIDNo INTEGER = NULL
SELECT IDNo INTO vIDNo INDIC ivIDNo +
FROM tablename WHERE COUNT = INSERT
-- end

The variable vIDNo will be the last IDNo
based on your last successful insert.

That's all there is to it!

Very Best R:egards,

Razzak.

--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: 
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, 
place any 
text to search for.
================================================

Reply via email to