Search This Blog

Tuesday, October 16, 2007

Return a value from a strore procedure value

Store procedures can return value using a return statement in the store procedure

you can do something like this

create PROCEDURE dbo.test1
(
@iID int
)
AS
BEGIN
SET NOCOUNT ON;

Declare @iNewId int

set @iNewId = @iID + 1
return @iNewId
END

declare @iT int
exec @iT = dbo.test1 6

print @iT

No comments: