error:The parameterized query '(@param1 int,@Paramout int OUTPUT)' expects the parameter '@Paramout', which was not supplied.

  • I am using sp_executesql and I get the following error

    Declare @retProcVal int

    SELECT @SqlString2 = N'use @dbName exec PROC_01 @param1,@paramout OUTPUT'

    set @ParamDef = N'@param1 int,@paramout int OUTPUT'

    SET @SqlString2 = Replace(@sqlString2,'@dbName',@dbName)

    EXECUTE sp_executesql @SqlString2 ,@ParamDef, @param1 = @intHosp,@paramout = @retProcVal OUTPUT

    --PROC_01 returns 0 upon sucess and 1 upon failure.

    Cannot tell where is the bug.

    Thanks

  • What is the error message you are receiving?

    Kurt

    Kurt W. Zimmerman
    SR DBA
    Lefrak Organization
    New York, NY

    http://www.linkedin.com/in/kurtwzimmerman

  • error:The parameterized query '(@param1 int,@Paramout int OUTPUT)' expects the parameter '@Paramout', which was not supplied.

  • Is it possibly a collation issue? I notice in your code the parameter is uncapitalized (@paramout), but in the error message it is capitalized:

    error:The parameterized query '(@param1 int,@Paramout int OUTPUT)' expects the parameter '@Paramout', which was not supplied.

    What happens if you capitalize it in your code, as below:

    Declare @retProcVal int

    SELECT @SqlString2 = N'use @dbName exec PROC_01 @param1,@Paramout OUTPUT'

    set @ParamDef = N'@param1 int,@Paramout int OUTPUT'

    SET @SqlString2 = Replace(@sqlString2,'@dbName',@dbName)

    EXECUTE sp_executesql @SqlString2 ,@ParamDef, @param1 = @intHosp,@Paramout = @retProcVal OUTPUT

  • I figured out what the issue was. There were two stored procedure calls ( I did not have that code in the post) .

    Both calls were using the same paramdef. Separated the paramdef and it worked. Thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply