Groups | Blog | Home
all groups > sql server (alternate) > august 2003 >

sql server (alternate) : can not retrive @@identity value


hlang121 NO[at]SPAM yahoo.com
8/27/2003 1:36:18 PM
I use select @@identity to return @@identity from my store procedure,
but I could not retrive it from my Visual basic code, like variable=
Erland Sommarskog
8/27/2003 9:54:57 PM
Allan (hlang121@yahoo.com) writes:
[quoted text, click to view]

So how does the VB code look like? And how does the stored procedure
look like?

Your chances to precise assistance increases if you care to share
the code you are having problem.
--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
John Bell
8/27/2003 10:44:07 PM
Hi

At a guess it is probably because it is not the first recordset being
returned.

Instead it may be best to use an output parameter to do this.

Also if you are using SQL 2000 then use the SCOPE_IDENTITY() function.

John


[quoted text, click to view]

raghuraman_ace NO[at]SPAM rediffmail.com
8/29/2003 4:55:30 AM
Hi,

One of the easiest way to get the identity value from sqlserver7.0, is

rs.open"select @@identity as id from tab1",..,..
box1 = rs!id


With Thanks
AddThis Social Bookmark Button