Output Parameter Not Returned

Posted by Mark Plumpton on Stack Overflow See other posts from Stack Overflow or by Mark Plumpton
Published on 2010-03-18T07:49:29Z Indexed on 2010/03/18 7:51 UTC
Read the original article Hit count: 294

Filed under:

Why does this script return a pair of nulls? I'm using SQL Server 2008, script run in MSSMS.

CREATE PROCEDURE proc_Test
    (
    @Input int,
    @Out1 int OUTPUT,
    @Out2 varchar(10) OUTPUT
    )

AS

BEGIN
    SET NOCOUNT OFF
    SET @Out1 = 100 + @Input
    SET @Out2 = 'result=' + CONVERT(varchar,@Out1)
    RETURN

END

GO

DECLARE @Out1 int, @Out2 varchar(10)
exec proc_Test  @Input=1, @Out1=@Out1, @Out2=@Out2
select @Out1, @Out2

© Stack Overflow or respective owner

Related posts about sql-server