For the complete documentation index, see llms.txt. This page is also available as Markdown.

BulkInsert

Execute bulk insert JSON data to Microsoft SQL Server.

Task version: 3.3.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

🗝ConnectionString : String

Connection string.

Default: Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword; Example: Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

TableName : String

Destination table name.

Default: - Example: TestTable

ColumnMapping : ColumnMapping

Selection for column mapping operation.

Possible values:

  • JsonPropertyOrder: Selection for column mapping operation.

  • JsonPropertyNames: Selection for column mapping operation.

  • ManualColumnMapping: Selection for column mapping operation.

Default: 0 Example: ColumnMapping.JsonPropertyNames

ManualColumnMapping : String

Column mapping JSON for manual column mapping.

JSON property cannot be a nested one. Only top level properties are supported.

Default: - Example: { "json_property_1": "db_column_1", "json_property_2": "db_column_2", "json_property_3": "db_column_3" }

InputData : String

Json Array of objects. All object property names need to match with the destination table column names.

Default: [{"Column1":"Value1", "Column2":15},{"Column1":"Value2", "Column2":30}] Example: [{"Column1":"Value1", "Column2":15},{"Column1":"Value2", "Column2":30}]

Name
Description

CommandTimeoutSeconds : Int32

Number of seconds for the operation to complete before it times out.

Default: 60 Example: 60

NotifyAfter : Int32

Defines the number of rows to be processed before generating a notification event.

The default value of 0 will set NotifyAfter dynamically to 10% of the total row count, with a minimum value of 1.

A value of -1 means there won't be any notifications until the task is completed.

Setting a value greater than the total number of rows can cause notification response to be 0.

Notification events can be used for error handling to see approximately which row the error occurred at.

Default: - Example: 0

FireTriggers : Boolean

When specified, cause the server to fire the insert triggers for the rows being inserted into the database.

Default: False Example: false

KeepIdentity : Boolean

Preserve source identity values. When not specified, identity values are assigned by the destination.

Default: False Example: false

TableLock : Boolean

Obtain a bulk update lock for the duration of the bulk copy operation. When not specified, row locks are used.

Default: False Example: false

KeepNulls : Boolean

Preserve null values in the destination table regardless of the settings for default values.

When not specified, null values are replaced by default values where applicable.

Default: False Example: false

ConvertEmptyPropertyValuesToNull : Boolean

If the input properties have empty values i.e. "", the values will be converted to null if this parameter is set to true.

Default: False Example: false

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

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

Name
Description

Success : Boolean

Operation complete without errors. Example: true

Count : Int64

Number of processed rows. In case of failure it shows notified number of processed rows. Approximation logic is defined by Options.NotifyAfter Example: 100

ErrorMessage : String

Error message. This value is generated when an exception occurs and Options.ThrowErrorOnFailure = false. Example: Login failed for user 'user'.

Task Changelog

Changelog for Task Frends.MicrosoftSQL.BulkInsert.

[3.3.0] - 2026-06-18

Changed

  • In successful execution, Result.Count will show number of all rows.

  • In case of failure, Result.Count will show estimated number of rows copied before the failure.

[3.2.0] - 2026-06-18

Changed

  • Update documentation.

[3.1.0] - 2026-01-22

Changed

  • Improve execution of async methods.

[3.0.0] - 2025-01-15

Added

  • [Breaking] Added parameters ColumnMapping and ManualColumnMapping.

  • Added column mapping feature which allows user to select from JsonPropertyNames, JsonPropertyOrder and ManualColumnMapping options how the column mapping is handled in bulk insert. Default behavior will remain the same JsonPropertyOrder.

[2.2.0] - 2024-09-10

Changed

  • Updated Options.NotifyAfter property to be set dynamically based on the total row count, with a minimum value of 1, ensuring rowsCopied is updated correctly.

[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.1.0] - 2023-01-26

Added

  • Options.ThrowErrorOnFailure and Result.ErrorMessage was added to let the user choose how to handle errors.

[1.0.0] - 2023-01-10

Added

  • Initial implementation

Last updated

Was this helpful?