Skip to main content

Batch insert

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

This command allows you to efficiently insert multiple records from a data table or Excel file into a database using a single SQL insert statement.

Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Database

Select a database connection

Yes

Must be a previously configured database connection

Data source

Choose the source of the data for batch insertion

Data table, Excel

Yes

Data table

The source data table containing the records to be inserted

Yes (if Data source is "Data table")

File path

Enter or browse to the path of an Excel or CSV file

Yes (if Data source is "Excel")

Worksheet

Enter the worksheet index (starting from 1) or the worksheet name

Yes (if Data source is "Excel")

SQL insert statement

Use @columnName@ to reference columns in your DataTable

Yes

The placeholders will be replaced with actual data during execution

Timeout (s)

Set the maximum execution time for the SQL statement in seconds

Yes

Default is 30 seconds

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action doesn't produce any variables.


Using Variables in Conditions

You can use variables in the SQL insert statement by inserting them with the {x} syntax. This allows you to dynamically generate SQL statements based on previously defined variables. When using variables, ensure that the variable type matches the expected input type for the parameter.


Notes

  • For optimal performance, consider the number of records being inserted at once and adjust the timeout value accordingly.

  • Use the @columnName@ syntax in your SQL insert statement to reference columns from your data table.

  • The SQL statement should follow proper SQL syntax for the target database.

  • Ensure your database connection has appropriate permissions for insert operations.

  • For large datasets, consider breaking the insertion into smaller batches to prevent timeout issues.

  • The SQL tools button provides access to helpful SQL generation utilities.

Did this answer your question?