DF158: An unnamed parameter is used after a named parameter in the EXECUTE procedure statement.

The topic describes the DF158 T-SQL code analysis rule.

Category

EXECUTION RULES

Message

An unnamed parameter is used after a named parameter in the EXECUTE procedure statement.

Description

If the parameter name is used for any parameter, it must be used for all subsequent parameters.

Additional information

When mixing named and unnamed parameters, there is a risk of misalignment between the parameters passed to the procedure and the parameters expected by the procedure. This can result in incorrect data being passed to the procedure or in the procedure not functioning as intended.

This can also make the code less readable and harder to maintain. In case of errors or unexpected behavior, debugging becomes more challenging and identifying the source of the problem can be more time-consuming and error-prone.

Noncompliant code example

EXEC @Result = dbo.DemoProcedure @x = 12
                                ,10
GO

Compliant solution

EXEC @Result = dbo.DemoProcedure @x = 12
                                ,@y = 10
GO

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Studio in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Studio for your business, request a demo to see it in action.
Ready to start using dbForge Studio for SQL Server?