Hi there<BR><BR>I've got a stored procedure that does an insert to a table. In the same stored procedure I want to grab the id after the insert and give it to the update. Any ideas examples.<BR><BR>thanksa.
RE: How to get an id from an insert into an update
Since you are talking about stored procedures I assume you are working with SQL Server.<BR><BR>Look up the @@IDENTITY in books-online:<BR><BR>CREATE PROCEDURE dbo.MyProcedure<BR> @MyValue int<BR>AS<BR>DECLARE @ID int<BR>INSERT INTO MyTable (MyColumn) VALUES (@MyValue)<BR>SET @ID = @@IDENTITY<BR><BR>RETURN @ID<BR>GO