Hi,
I have the same problems in ASP and any tips on that will be greatly
appreciated. Thanks.
-ann
-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Friday, October 20, 2000 4:53 AM
To: sql language
Subject: [sql_language] Re: returning an auto value
You can use the @@identity value. This will contain the ID of the last
inserted record.
Do something like this:
<SPROC>
CREATE PROCEDURE spMySproc
@ID int,
@Description varchar(100)
AS
SET NOCOUNT ON
INSERT INTO tblMyTable (ID, Description)
VALUES (@ID, @Description)
SET NOCOUNT OFF
Return @@Identity
</sproc>
This will return the last ID to the calling application
If you need help to retrieve this return value in for instance
ASP, let me
know, and I'll give you some tips on that.
HtH
Imar
At 03:21 PM 10/18/2000 +0100, you wrote:
>Hi
>
>Hope someone can help with this.
>
>I'm writing a procedure that inserts a row in a table - what I
want it to
>do is get the auto increment number that it inserts and use
this as data
>for an insert in to another table
>
>How would I go about it ?
>
>thanks in advance
>
>Silk
>