Getting Back Identity column value on Insert using RDS

Getting Back Identity column value on Insert using RDS

Post by VEDA » Mon, 08 Dec 1997 04:00:00



 Does anyone know of an easy way to get back the identity column value on an
insert using
RDS from a web page ?


to work with RDS. It always
returns NULL, may be because RDS drops the connection after each query ?

Sending the insert record to a DCOM object on the server and have that do
the insert and the return the identity value seems to be the only solution
to me. Is there anyway to avoid this extra step ?

Thanks in advance for any suggestions

Sundar B

 
 
 

Getting Back Identity column value on Insert using RDS

Post by steve robinso » Tue, 09 Dec 1997 04:00:00


VEDAS,

Could you use VB RDO to execute a stored procedure which does both the


this is a session specific value and hence new session then is set to null.

--
Steve Robinson MCP (SQL /NT)




>  Does anyone know of an easy way to get back the identity column value on
an
> insert using
> RDS from a web page ?


seem
> to work with RDS. It always
> returns NULL, may be because RDS drops the connection after each query ?

> Sending the insert record to a DCOM object on the server and have that do
> the insert and the return the identity value seems to be the only
solution
> to me. Is there anyway to avoid this extra step ?

> Thanks in advance for any suggestions

> Sundar B


 
 
 

1. Getting back an identity field value after an insert SQL statement

Got some code doing an insert for a new record in a table, first field in
the table is ID which is the primary key, an int data type and is set to be
an identity  field with identity seed 1 and increment = 1.

After the insert statement has correctly completed, how do I get back the Id
for the record that my code has just created?
I know I could do a select statement getting the top 1 value of the ID back
but this does not guarantee that in a multi-user environment someone else
has not just added a record practically at same time as me and that I might
be getting back his record Id instead of my own newly created one. Chances
of this happening are slim but I want  to be sure to use a method that
prevents this from ever happening.

Thanks for any help.

Bob

2. What is the best Java Book.

3. Getting the value of an IDENTITY column after an INSERT query

4. scheduled task / job / creating one with tsql code

5. Inserting values in the IDENTITY columns using DTS

6. Denver, CO--PowerBuilder developer position available

7. Identity -- Getting it back on Insert

8. Union All

9. Getting back identity after an insert via ADO?

10. INSERT INTO with SELECT DISTINCT causes a zero value to be inserted into an IDENTITY column

11. Getting rid of the IDENTITY property on a column withou getting rid of the column

12. Getting IDENTITY value BEFORE an insert(?!)

13. Getting the value of an autoincrement or identity field during an sql insert