The formal parameter “%.*ls” was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

Error Message:
Msg 8162, Level 16, State 2, Procedure , Line 0
The formal parameter “%.*ls” was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.

Severity level:
16.

Description:
This error message appears when you try to request an OUTPUT parameter from a stored procedure that was not declared as OUTPUT parameter.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be run this way. You can not request the output from a parameter that was not declared as OUTPUT parameter.

Versions:
All versions of SQL Server.

Example(s):
IF OBJECT_ID(‘dbo.p’) IS NOT NULL
    DROP PROCEDURE dbo.p;
GO
CREATE PROCEDURE dbo.p
    @p1 int
AS
SELECT @p1;
GO

DECLARE @p1 int;

SET @p1 = 1;
EXEC dbo.p @p1 OUTPUT;

Remarks:
In the above example we try to request the output of parameter @p1. Since this parameter was not declared as OUTPUT in the procedure, the error is raised.




Array

No comments yet... Be the first to leave a reply!