BulkInsert

Estimated reading: 4 minutes 1772 views

This activity assists the user in uploading or inserting a large data table into the specified database server for a specific table.

Properties

INPUT

CommandTimeout: This parameter indicates the timeout value for executing the activity within the connected database. If the execution cannot be established within this specified time, it will throw an exception.

This parameter accepts values in “Integer” datatype. You can either enter the values hardcoded in “INT32” format or pass the values as “Int32” datatype.

Datatable*: This parameter indicates providing the “DataTable” value where the input has been stored to execute the bulk insert option. This parameter accepts values in the “DataTable” data type.

SQLConnection*: This parameter indicates the existing SqlConnection to be provided for execution of the activity. Here, you should mention the output variable declared in the “ConnectDB” activity. This parameter only accepts values in the “SqlConnection” data type.

TableName*: This parameter indicates providing the “TableName” from the connected database to perform a bulk data insertion.

It accepts values in “String” datatype. You can either enter the values hardcoded in “String” format or pass the values as “String” datatype.

MISC

DisplayName: Displays the name of the activity. The activity name can be customized, which aids in troubleshooting.

SkipOnError: Specify the “Boolean” value as “True” or “False.”

True: Continue executing the workflow regardless of any errors thrown.
False: Halt the workflow if it encounters any errors.
None: If the option is left blank, the activity will, by default, behave as if “False” were chosen.

Version: It indicates the version of the feature being used.

OUTPUT

Result: It provides the ability to view the execution status of the activity. It returns values in “Boolean.”

True: Indicates that the activity has been executed successfully without any errors.
False: Indicates that the activity has been unsuccessful due to an unexpected error being thrown.

Represents mandatory fields to execute the workflow.

Here’s an example of how the activity is used in the workflow –

In the following example, utilizing this activity I am going to insert the data into a table in my database from an excel sheet. Here, I have already extracted the datatable value from an excel sheet and stored in a variable. You can refer the steps on how to extract the datatable from the excel sheet here – Click here.

Now I am continuing from the “ConnectDB” activity. 

Please note that in the following example, I have added the credentials in a respective variable which is then used in the example.

Steps to build the bot:

1. Create a solution.
2. Drag and drop the “BulkInsert” activity and place it below the “ConnectDB” activity.
a. Double click on the activity to provide the “TableName”.
b. Here I have already created a table in the provided database. Hence, my table name is “Employees”. Click here to know how to create a table
3. Now, navigating to the “Datatable” in the properties, here I am providing the input datatable as the variable declared as output in the “ReadRange” activity.
4. Next, moving to the “SqlConnection” in the properties, Here I am utilizing the variable “DB_OUTPUT” declared as output in the “ConnectDB” activity.
5. Moving to the “Result” in the output section of the properties to view the state of the activity.
a. There are two ways to declare a variable –
b. Method 1: Double-click on the variable parameter in the Output section and enter a name that helps you easily identify the flow. Here, I’m using the name “Bulk_Status” and using the shortcut key “Ctrl+Q” to create the variable.
c. Method 2: Click on the variable pane, enter your preferred name. (here, I’m using “Bulk_Status”), and choose the data type as “Boolean” since the values are returned as “True or False”.
6. You can use the write log activity to print the “Bulk_Status” variable output.
a. Here the input is “Bulk Insert Status:” + Bulk_Status. ToString”.
b. Then choosing the log level as “Info”.
7. Now, save and execute the workflow.

The bot will execute and insert the data into the table in the database. 

Share this Doc

BulkInsert

Or copy link

CONTENTS