Configure the OLE DB Command Transformation
To add and configure an OLE DB Command transformation, the package must already include at least one Data Flow task and a source such as a Flat File source or an OLE DB source. This transformation is typically used for running parameterized queries.
To configure the OLE DB Command transformation
-
In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.
-
In Solution Explorer, double-click the package to open it.
-
Click the Data Flow tab, and then, from the Toolbox, drag the OLE DB Command transformation to the design surface.
-
Connect the OLE DB Command transformation to the data flow by dragging a connector—the green or red arrow—from a data source or a previous transformation to the OLE DB Command transformation.
-
Right-click the component and select Edit or Show Advanced Editor.
-
On the Connection Managers tab, select an OLE DB connection manager in the Connection Manager list. For more information, see OLE DB Connection Manager.
-
Click the Component Properties tab and click the ellipsis button (…) in the SqlCommand box.
-
In the String Value Editor, type the parameterized SQL statement using a question mark (?) as the parameter marker for each parameter.
-
Click Refresh. When you click Refresh, the transformation creates a column for each parameter in the External Columns collection and sets the DBParamInfoFlags property.
-
Click the Input and Output Properties tab.
-
Expand OLE DB Command Input, and then expand External Columns.
-
Verify that External Columns lists a column for each parameter in the SQL statement. The column names are Param_0, Param_1, and so on.
You should not change the column names. If you change the column names, Integration Services generates a validation error for the OLE DB Command transformation.
Also, you should not change the data type. The DataType property of each column is set to the correct data type.
-
If External Columns lists no columns you must add them manually.
-
Click Add Column one time for each parameter in the SQL statement.
-
Update the column names to Param_0, Param_1, and so on.
-
Specify a value in the DBParamInfoFlags property. The value must match a value in the OLE DB DBPARAMFLAGSENUM enumeration. For more information, see the OLE DB reference documentation.
-
Specify the data type of the column and, depending on the data type, specify the code page, length, precision, and scale of the column.
-
To delete an unused parameter, select the parameter in External Columns, and then click Remove Column.
-
Click Column Mappings and map columns in the Available Input Columns list to parameters in the Available Destination Columns list.
-
-
Click OK.
-
To save the updated package, click Save on the File menu.
