Execute Non Query
Description
This activity executes SQL statements on a database. For Update, Insert, and Delete statements; it does not return any result sets. It returns the number of rows affected for non-query statements. For all other types of statements, the return value is -1.
Properties
Input
- Command Type – It specifies how a command string gets interpreted. The following options are available, Text, Stored procedure, Table direct.
- Text - It includes the name of the stored procedure to execute in SQL parameters.
- StoredProcedure - Invokes the procedure name specified in the SQL parameter.
- TableDirect - It contains the name of the Table and gets all records from the Table. By default, it sets to Text.
- Connection String – TIt specifies the connection string to establish a database connection.
- Database Context – It specifies the Database context variable.
Note: If the Database Context variable used here returns by the Connect activity, it ignores all properties (Connection String and Provider Name) related to the database connection.
- Parameters – It specifies the dictionary of named parameters bound to the SQL command. It performs the binding by setting the '@parameter Name' statement in the SQL command. At runtime, it will replace the parameter Name with its value from the dictionary.
- Provider Name – It specifies the name of the database provider used to access the database.
- Query – SQL query or stored procedure to be executed.
- Timeout (in MS) – It specifies the time to wait for the activity to run before any error occurs. The default value is 30000 milliseconds (30 seconds).
Note: The amount of time specified in this field does not include the response time for the query result retrieval. The total execution time of the activity may be greater than the actual query execution time, to which the Timeout MS property applies.
Misc
- DisplayName – Add a display name to your activity.
- Private – By default, activity will log the values of your properties inside your workflow. If private is selected, then it stops logging.
Optional
- Continue On Error – Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False.
Note: If this activity is included in Try Catch and the value of this property is True, no error is caught when the project is executed.
Output
- Records Affected – It displays the result of the execution of the SQL command. The return value is the number of rows affected by the command for UPDATE, INSERT, and DELETE statements. For all other types of statements, the return value is -1.
Example
Download Example