|
SQL Server & VB2005: How 2 return an IDvalue (with... -
December 28th, 2007
...identity YES) for a record I just added with stored proced? I have a SQL Server - DB and I have a stored procedure that add a record to a table that have an ID column with an automatic value (IDENTITY = YES), what I want is to return that new value ID to my calling command each time that I add a new record.
Here is my SP:
**********
ALTER PROCEDURE dbo.SP1
(
@MyName varchar(50)
)
AS
SET NOCOUNT OFF;
insert into Table1
(MyName)
values (@MyName)
select @@IDENTITY
return ;
*********
How to know that new 'ID' ?
|