Original: An issue in SSIS that performs SQL task component parameter passing
Symptom: Execute SQL task, pass parameter to subquery, execute error.
Error: failed with error: "Cannot derive parameter information from an SQL statement that uses a sub-select query. Please set the parameter information before preparing the command. ”。 The reasons for the failure may be that the query itself is problematic, the "ResultSet" property is not set correctly, the parameters are not set correctly, or the connection is not established correctly.
Reason:
Using parameters in the OLE DB Connection Manager
If the Execute SQL task uses the OLE DB Connection Manager, the bypassprepare property of the task is available. This property should be set to trueif the Execute SQL task uses an SQL statement with parameters.
When using the OLE DB connection Manager, parameterized subqueries cannot be used because the Execute SQL task cannot get parameter information through the OLE DB provider. However, you can use an expression to concatenate parameter values into a query string and set the Sqlstatementsource property of the task.
Workaround: Set the bypassprepare property to true.
Problems with executing SQL task component parameter passing in SSIS