ExecuteProcedure
Execute Microsoft SQL Server procedure.
Task version: 2.3.0
Required Frends version: 5.5+
Required .NET version: 6.0
Compatible Agents: Crossplatform
Task Parameters
🗝ConnectionString : String
Connection string.
Default: Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Example: Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Execute : String
Name of stored procedure to execute.
Should only contain the name of the procedure without, for example, database name or semicolons.
Default: -
Example: ExampleProcedure
Parameters : ProcedureParameter[]
Parameters for stored procedure.
Default: -
Example: [ { Name = "id", Value = 1, DataType = SqlDataTypes.Auto }, { Name = "first_name", Value = "John", DataType = SqlDataTypes.NVarChar }, { Name = "last_name", Value = "Doe", DataType = SqlDataTypes.NVarChar } ]
ExecuteType : ExecuteTypes
Specifies how a command string is interpreted.
ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned.
NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.
Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.
Possible values:
NonQuery: Specifies how a command string is interpreted.
ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned.
NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.
Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.
Scalar: Specifies how a command string is interpreted.
ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned.
NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.
Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.
ExecuteReader: Specifies how a command string is interpreted.
ExecuteReader: Use this operation to execute any arbitrary SQL statements in SQL Server if you want the result set to be returned.
NonQuery: Use this operation to execute any arbitrary SQL statements in SQL Server if you do not want any result set to be returned. You can use this operation to create database objects or change data in a database by executing UPDATE, INSERT, or DELETE statements. The return value of this operation is of Int32 data type, and For the UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the SQL statement. For all other types of statements, the return value is -1.
Scalar: Use this operation to execute any arbitrary SQL statements in SQL Server to return a single value. This operation returns the value only in the first column of the first row in the result set returned by the SQL statement.
Default: 2
Example: ExecuteType.ExecuteReader
ThrowErrorOnFailure : Boolean
(true) Throw an exception or (false) stop the Task and return result object containing Result.Success = false and Result.ErrorMessage = 'exception message'.
Default: True
Example: true
CommandTimeoutSeconds : Int32
Number of seconds for the operation to complete before it times out.
Default: 60
Example: 60
SqlTransactionIsolationLevel : SqlTransactionIsolationLevel
Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Possible values:
None: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Default: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
ReadUncommitted: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
ReadCommitted: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
RepeatableRead: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Serializable: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Snapshot: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Unspecified: Starts a database transaction with the specified isolation level.
Isolation evel specifies the transaction locking behavior for the connection.
None: No transaction is set up so there won't be a rollback if exception occurs.
Default: Default is configured by the SQL Server, usually ReadCommited.
ReadCommitted: (Default value in most of the SQL Servers). Shared locks are held while the data is being read to avoid dirty reads, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
Unspecified: A different isolation level than the one specified is being used, but the level cannot be determined.
ReadUncommitted: A dirty read is possible, meaning that no shared locks are issued and no exclusive locks are honored.
RepeatableRead: Locks are placed on all data that is used in a query, preventing other users from updating the data.Prevents non-repeatable reads but phantom rows are still possible.
Serializable: A range lock is placed on the System.Data.DataSet, preventing other users from updating or inserting rows into the dataset until the transaction is complete.
Snapshot: Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
Default: 4096
Example: SqlTransactionIsolationLevel.ReadCommitted
Task Result
Success : Boolean
Operation complete without errors.
Example: true
RecordsAffected : Int32
Records affected. Some statements will return -1. See Input.ExecuteType's documentation for more information.
Example: 100
ErrorMessage : String
Error message. This value is generated when an exception occurs and Options.ThrowErrorOnFailure = false.
Example: Login failed for user 'user'.
Data : Object
Procedure's result as JToken.
Example: Input.ExecuteType = ExecuteReader: [{"ID": "1","FIRST_NAME": "Saija","LAST_NAME": "Saijalainen","START_DATE": ""}], Input.ExecuteType = NonQuery: {{ "AffectedRows": -1 }}, Input.ExecuteType = Scalar: {{ "Value": 1 }}
Task Changelog
Changelog for Task Frends.MicrosoftSQL.ExecuteProcedure.
[2.3.0] - 2026-01-22
Changed
Improve execution of async methods.
[2.2.0] - 2024-12-16
Added method to form JToken from the SqlDataReader so that SqlGeography and SqlGeometry typed objects can be handled.
Fixed how Scalar handles the data so that SqlGeography and SqlGeometry typed objects can be handled.
Added Microsoft.SqlServer.Types version 160.1000.6 as dependency.
[2.1.0] - 2024-08-26
Changed
Updated Newtonsoft.Json to the latest version 13.0.3.
[2.0.0] - 2024-08-05
Changed
[Breaking] The task now uses Microsoft.Data.SqlClient instead of System.Data.SqlClient.
[1.2.1] - 2024-02-12
Fixed
Fixed issue with null parameters by changing them into DBNull.Value.
Updated
System.Data.SqlClient to version 4.8.6.
[1.2.0] - 2024-01-03
Changed
[Breaking] ProcedureParameter.Value type to object so that binary data can be used.
[1.0.1] - 2023-08-03
Changed
Documentation update to Input.Execute parameter.
Removed unnecessary runtime unloader.
[1.0.0] - 2023-01-23
Added
Initial implementation
Last updated
Was this helpful?

