Tuesday, 17 June 2014

SSIS + MS-Sql-Server parameterized queries in "Execute SQL Task"

Struggled a bit with getting parameters to work with hand-crafted SQL in an "Execute SQL Task" that used an OLE DB Connector to the MS-SQL-Server database.

Eventually, after some playing around and some googling I realized that the parameters (which are marked by ? in the query) need to be mapped (in "Parameter Mapping") to numbers (0-based) in the "Parameter Name" column.

Here is the summary of what I found:
ConnectorParameter Names
OLE DB0,1,2...
ODBC0,1,2...
Excel0,1,2...
ADO1,2,3...
ADO.NET@namedParameters...

Special thanks to: this answer on stackoverflow by Teju MB and christiandev