SmartConnect 2018

Run MSSQL Command Task

The Run MSSQL Command task allows MSSQL statements to be created and executed as part of map processing. It is useful for updating or reading values in a MSSQL server.

 

To create a run MSSQL command task:

1.Select the tasks tab on the map setup window.
2.Select the task stage in the task tree to determine that stage at which this task will run.
3.Right click on the tasks stage, select new task, the select the run SQL command task.

SmartConnect_Tasks_Add

 

4.Enter the name of the task. Task names must be unique within each map.
5.Check the enable checkbox to enable the task.
6.Select a Connection from the drop down list. If Custom Connection is selected the server, authentication details and database selection will be required. If a default connection is selected the server, authentication details and database selections will be grayed out and defaulted from the selected connection. If a new default connection should be set select the manage default connections button Default_MSSQL_Connections and enter the new details.
7.Enter the name of the MSSQL Server / Instance to be used for this task. This may be defaulted by the connection selected in step 6.
8.Select the required authentication type. Windows authentication will use the details for the current windows user to try to connect to the MSSQL server. Selecting SQL Server Authentication will required the entry of a MSSQL username and password. This setting may be defaulted by the connection selected in step 6.
9.If required enter the MSSQL login username. This may be defaulted by the connection selected in step 6.
10.If required enter the MSSQL password. This may be defaulted by the connection selected in step 6.
11.Select the Connect button to use the entered details to connect to the MSSQL server. If the connection is successful available databases will be displayed in the database drop-down list.
12.If required select the MSSQL database from the drop-down list. This selection may be defaulted by the connection selected in step 6.
13.Enter the required action if the run file task fails. Selecting Quit will halt map processing if the copy fails. Go to next step will record the failure but allow processing to continue. Cancel processing will stop map processing but will not return an error to the user.
14.Enter the required action if the run file task succeeds. Selecting Quit will halt map processing if the copy fails. Go to next step will continue to the next step in map processing. Cancel processing will stop map processing but will not return an error to the user.
15.If a value is returned by the MSSQL command, and the value is to be used during further processing check the Update global variable with SQL command result checkbox. Note: only the first column from the first row of the MSSQL result can be returned and used for further processing. All results are return as string.
16.If required select the variable to receive the value returned from the MSSQL command. Only User Global Variables may be selected.
17.Enter the MSSQL command to be run against the server. For map tasks only Global variables may be used within the command with the values substituted at run-time. For document tasks Global and Data variables may be used within the command. Select the Insert Variable button to receive a list of variables that may be used in the command.
18.Select the Load Template button if the content of the command may be loaded from a predefined SQL command template. Select the required template then enter any variable details requested. Click OK to return the template details to the command task.
19.Select Save to save the task.

 

SQL Command

 

To edit a run SQL command task:

1.Select the tasks tab on the map setup window.
2.Either double click on the task to be edited, or select the task, right click then select edit.

 

To delete a run SQL command task:

1.Select the tasks tab on the map setup window.
2.Either select the task, right click then select delete, or edit the task and select delete on the window toolbar.