ADO.NET ignores parameter names when IsQueryStoreProcedure is set to True

Gregory Lvov 0 Reputation points
2025-09-22T13:08:39.9766667+00:00

ADO.NET ignores parameter names when IsQueryStoreProcedure is set to True.

I use the "Execute SQL Task" to call a stored procedure with optional parameters via ADO.NET .

The following situation occurs with all providers except System.Data.SqlClient.

for example, there is a stored procedure dbo.spCallMe @p1 = null, @p2 = null, @p3 = null

I enter in SQLStatment [dbo] .[spCallMe]

IsQueryStoredProcedure is true

In the Parameter Mapping tab, I compare only two parameters.:

var1 -> @p1 and var3 -> @p3

However!

When completing the task, the provider changes the mapping to sequential:

var1 -> @p1 and var3 -> @p2 !!

And in general, you can specify any parameter names in the mapping, and even numbers. This will work and also pass parameters according to the order in which they are defined in the stored procedure.

The parameter names are taken into account only by the provider "Net Provider\SqlClient Data Provider"

All the others ADO.NET the providers behave the same way as if I were using OleDb or sql script (IsQueryStoredProcedure is false).

Is this a bug or a feature?

Please note that in the documentation https://free.blessedness.top/en-us/sql/integration-services/control-flow/execute-sql-task?view=sql-server-ver17

There are no details about this in the "Use parameters with stored procedures" section.

SQL Server Integration Services
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sheeraz Ali 170 Reputation points
    2025-09-26T08:45:26.1633333+00:00

    it’s not a bug in SSIS — it’s a provider limitation. Only SqlClient implements true named parameter binding; all others are positional only.

    Workarounds

    Include all params in SSIS mapping, even if unused → pass NULL for skipped ones.

    Wrapper proc: create a procedure that only exposes the params you need.

    Single param (JSON/TVP): pack values into one parameter and unpack inside SQL.

    Use SqlClient provider if possible → names will work correctly.

    Easiest: map dummy NULL variables for unused parameters.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.