Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
@@IDENTITY & SQLVERVER
Message
From
30/11/2000 15:44:28
 
 
To
30/11/2000 13:46:41
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00447541
Message ID:
00447649
Views:
10
>Hello everyone,
>
>
>Is it possible to INSERT data and retrieve the new @@IDENTITY in one single instruction With ADO connection and SQLServer
>
>Ex:
>
>Connection.execute " INSERT INTO MyTable (MyField) VALUES ('Myvalue')
> SELECT @@IDENTITY AS 'MyIdentity' "
>
>MyNewIdentity = 'MyIdentity'
>
>
>Tanks
>
>Louis-André Morin

Besides what Eric suggested, you can also create a stored procedure with an output parameter that returns the new identity value. The difference is that you need to use an ADO command object with parameters to call such a stored procedure. The advantage is that the stored procedure runs faster and scales better.
Previous
Reply
Map
View

Click here to load this message in the networking platform