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.



Related Articles :

  • No Related Articles Found
Uncategorized

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

  1. Note that you may also get this error if your OUTPUT keyword is not in UPPERCASE in the procedure declaration.

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |