SQL Server - Bulk Load

On this Page

Snap type:



This Snap executes an SQL Server bulk load. The Snap uses the bcp utility program internally to perform the bulk load action. The input data is first written to a temporary data file, then the bcp utility program loads the data from the data file into the target table.

  • Expected upstream Snaps: The columns of the target table need to be mapped upstream using a Mapper Snap. The Mapper Snap will provide the target schema, which reflects the schema of the target table.
  • Expected downstream Snaps: None.
  • Expected input: Document that needs to be loaded.
  • Expected output: Document which represents the result of the bulk load operation.

Table Creation

If the table does not exist when the Snap tries to do the load, and the Create table property is set, the table will be created with the columns and data types required to hold the values in the first input document. If you would like the table to be created with the same schema as a source table, you can connect the second output view of a Select Snap to the second input view of this Snap. The extra view in the Select and Bulk Load Snaps are used to pass metadata about the table, effectively allowing you to replicate a table from one database to another.

The table metadata document that is read in by the second input view contains a dump of the JDBC DatabaseMetaData class. The document can be manipulated to affect the CREATE TABLE statement that is generated by this Snap. For example, to rename the name column to full_name, you can use a Mapper (Data) Snap that sets the path $.columns. Name.COLUMN_NAME to full_name.  The document contains the following fields:

  • columns - Contains the result of the getColumns() method with each column as a separate field in the object. Changing the COLUMN_NAME value will change the name of the column in the created table. Note that if you change a column name, you do not need to change the name of the field in the row input documents. The Snap will automatically translate from the original name to the new name. For example, when changing from name to full_name, the name field in the input document will be put into the "full_name" column. You can also drop a column by setting the COLUMN_NAME value to null or the empty string.  The other fields of interest in the column definition are:

    • TYPE_NAME - The type to use for the column.  If this type is not known to the database, the DATA_TYPE field will be used as a fallback.  If you want to explicitly set a type for a column, set the DATA_TYPE field.

    • _SL_PRECISION - Contains the result of the getPrecision() method.  This field is used along with the _SL_SCALE field for setting the precision and scale of a DECIMAL or NUMERIC field.

    • _SL_SCALE - Contains the result of the getScale() method.  This field is used along with the _SL_PRECISION field for setting the precision and scale of a DECIMAL or NUMERIC field.

  • primaryKeyColumns - Contains the result of the getPrimaryKeys() method with each column as a separate field in the object.

  • declaration - Contains the result of the getTables() method for this table. The values in this object are just informational at the moment.  The target table name is taken from the Snap property.

  • importedKeys - Contains the foreign key information from the getImportedKeys() method. The generated CREATE TABLE statement will include FOREIGN KEY constraints based on the contents of this object. Note that you will need to change the PKTABLE_NAME value if you changed the name of the referenced table when replicating it.

  • indexInfo - Contains the result of the getIndexInfo() method for this table with each index as a separate field in the object.  Any UNIQUE indexes in here will be included in the CREATE TABLE statement generated by this Snap.

The Snap will not automatically fix some errors encountered during table creation since they may require user intervention to resolve correctly. For example, if the source table contains a column with a type that does not have a direct mapping in the target database, the Snap will fail to execute. You will then need to add a Mapper (Data) Snap to change the metadata document to explicitly set the values needed to produce a valid CREATE TABLE statement.

SQL Server BCP program only accepts date time values in format YYYY-MM-dd HH:mm: ss,  thus SQL Server Bulk Load Snap only accepts two types of data as the input of a DATETIME column:

  • A Joda DateTime object. For example, a Joda DateTime object can be created with expression Date.now() in Mapper Snap.
  • A plain string in the format: YYYY-MM-dd HH: mm:ss. Example: 2016-10-22 11:11:11.

 SQL Server Bulk Load Snap does not accept the results by the DateTime string from the expression Date.toLocaleDateTimeString().



The BCP utility must be installed on the Groundplex nodes on which you want to execute this Snap. To install the BCP utility on a Groundplex:

  1. Download and Install the BCP Utility in your Windows or Linux environment. For details on doing so, use the following links:
    1. Installing BCP on Linux
    2. Installing BCP on Windows
  2. Verify that you are able to run the bcp command.

    To verify BCP installation, enter bcp on the terminal or the command line console and press Enter.

    The output should look similar to the following. These are the command-line options that can be used with the BCP utility. If you see this output, it means that the BCP utility is installed and ready for use.

  3. Ensure that the path to the bcp command is correctly provided in the Snap.
  4. When using a Windows host as a SnapLogic node with the service installed (jcc.bat install_service), ensure that the service account used on the service credentials has access to the database for the bulk copy program utility (BCP) to work. Removing the database permissions result in the error, Unable to invoke BCP". However, you might still be able to execute the bcp -v command on the command line outside the Snaplogic node, despite the lack of service account database permissions.


Problem: Some characters appear as junk values after bulk load.

Reason: The Snaplex uses character sets defined in the OS on which they are installed. Due to this, any unrecognized character set is not supported by the Snaplex as well. As a result, such characters in the data set are represented as junk values in the database after a bulk load operation.

Resolution: This problem can be resolved by editing the bcp.bat file to accept custom characters. And using the absolute path to this bcp file in the BCP absolute path property. The bcp.bat file must contain the following:

This resolution is applicable only to Windows-based Snaplexes.

Support and limitations:

Does not work in Ultra Pipelines.


This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring SQL Server Accounts for information on setting up this type of account.


This Snap has one document input view by default. 

A second view can be added for metadata for the table as a document so that the target absent table can be created in the database with a similar schema as the source table. This schema is usually from the second output of a database Select Snap. If the schema is from a different database, there is no guarantee that all the data types would be properly handled.

OutputThis Snap has at most one document output view.

This Snap has at most one document error view and produces zero or more documents in the view.



Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Schema Name

Specify the database schema name. In case it is not defined, then the suggestion for the Table Name will retrieve all tables names of all schemas. The property is suggestible and will retrieve available database schemas during suggest values.

The values can be passed using the pipeline parameters but not the upstream parameter.

Example: SYS
Default value: None

Table Name*

Specify the table on which to execute the bulk load operation.

The values can be passed using the pipeline parameters but not the upstream parameter.

Example: people

Default value: None

Currently, the BCP utility in the Linux environment has a limitation while processing the table names.
When loading the data into a selected table and If the table name contains the characters '$%' or '!$', the combination works fine, however, BCP does not support if the table name contains the characters vice-a-versa as'%$' and '$!'.  

Supported by BCP: "dbo"."sqldemo#^&$%"   
Not supported by BCP: "dbo"."sqldemo#^&%$"  

Create table if not present

Select this check box to enable the Snap to automatically create a table if a table does not exist.

The data types for the columns in the new table depend on the data types coming from the upstream Snap. If a second input view exists, the Snap reads and uses the data types for the columns from this input view.

Default value: Not selected

BCP absolute path

Specify the absolute path of the bcp utility program in JCC's file system. If empty, the Snap looks for it in JCC's environment variable PATH.

Example: C:\bcp.bat

Default value:  [None]

bcp.bat should include the ".exe" extension to ensure the executable is actually referenced.

Handling Unrecognized Character sets in the Data set

Since the Snaplex uses the OS's default character set, it cannot recognize characters in other languages. Due to this, unrecognized characters in the data set are replaced with junk values when performing bulk load operations. To mitigate this, create a bcp.bat file and include the following line:

Use the path to this bcp.bat file in the BCP absolute path.

This is only applicable to Windows-based Snaplexes.

Maximum error count*

Specify the maximum number of rows which can fail before the bulk load operation is stopped.

Default value:  10  

Snap Execution

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

In a scenario where the Auto commit on the account is set to true, and the downstream Snap does depends on the data processed on an Upstream Database Bulk Load Snap, use the Script Snap to add delay for the data to be available.

For example, when performing a create, insert and a delete function sequentially on a pipeline, using a Script Snap helps in creating a delay between the insert and delete function or otherwise it may turn out that the delete function is triggered even before inserting the records on the table.


This example loads data from table bulk_test_source to table bulk_test_target with SQL Server Bulk Load Snap.

The pipeline:

The SQL Server Select Snap  gets records in the table bulk_test_source and passes them to the SQL Server Bulk Load Snap:

The SQL Server Bulk Load Snap that loads inputs to table bulk_test_target looks as follows:

The output of the SQL Server Bulk Load Snap after executing the pipeline:

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
4.27main12833 Stable

Enhanced the SQL Server - Execute Snap to invoke stored procedures.

4.26 Patch426patches12535Latest

Fixed an issue in the SQL Server Bulk Load snap where boolean data type failed to load into BIT field.

4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25 Patch425patches10797 Latest

Fixed an issue with the SQL Server - Bulk Load Snap where the Snap fails when the login password contains a colon or a less than (<) symbol.

StableUpgraded with the latest SnapLogic Platform release.

4.24 Patch

424patches8657 Latest

Enhances the SQL Server - Select Snap by introducing a new field, Query Hints, which helps to customize and optimize the database engine to process query statements.

  • Enhances the SQL Server - Select Snap to return only the selected output fields or columns in the output schema (second output view) using the Fetch Output Fields In Schema check box. If the Output Fields field is empty all the columns are visible.
  • Enhances the SQL Server - Stored Procedure to accept parameters from input documents by column keys. If the values are empty, the parameters are populated based on the column keys for easier mapping in the upstream Mapper Snap.
4.23 Patch423patches8190 Latest

Fixes an issue with SQL Server - Execute to handle SQL statements that begin with special characters.


Enhances the accounts in this Snap Pack to allow Windows-based (Active Directory) authentication and user impersonation for SQL Server user accounts.

4.22 Patch

422patches6728 Latest

Enhances the SQL Server Snap pack to allow Windows (Active Directory) based authentication and user impersonation for SQL Server user accounts.

StableUpgraded with the latest SnapLogic Platform release.

4.21 Patch

421patches6272 Latest

Fixes the issue where Snowflake SCD2 Snap generates two output documents despite no changes to Cause-historization fields with DATE, TIME and TIMESTAMP Snowflake data types, and with Ignore unchanged rows field selected.

4.21 Patch

421patches6144 LatestFixes the following issues with DB Snaps:
  • The connection thread waits indefinitely causing the subsequent connection requests to become unresponsive.
  • Connection leaks occur during Pipeline execution.

4.21 Patch

MULTIPLE8841 Latest

Fixes the connection issue in Database Snaps by detecting and closing open connections after the Snap execution ends. 

4.21 Patch 

db/sqlserver8837 Latest

Fixed the SQL Server - Stored Procedure Snap to support the UUID datatype.



StableUpgraded with the latest SnapLogic Platform release.

4.20 Patch 

db/sqlserver8793 Latest

Fixed an issue in the SQL Server - Insert Snap due to which the Snap failed to load values of data type INT.

4.20 Patch 

db/sqlserver8796 Latest

Fixed the SQL Server - Bulk Load Snap to mask the password in the logged exception messages

StableUpgraded with the latest SnapLogic Platform release.

4.19 Patch 

db/sqlserver8413 Latest

Fixed an issue with the SQL Server - Update Snap wherein the Snap is unable to perform operations when:

  • An expression is used in the Update condition property.
  • Input data contain the character '?'.
StableUpgraded with the latest SnapLogic Platform release.

4.18 Patch

 db/sqlserver7989 Latest

Fixed an issue in the SQL Server - Merge Snap wherein identity columns are not handled correctly. Also, added a field, Enable Identity Insert, that enables you to insert values into an identity column.

  • Added support for SQL Server account Active Directory authentication for SQL server for driver JAR version mssql-jdbc-6.2.2-jre8.jar.
  • Reverts a 4.17-patch (db/sqlserver7394) update regarding how BIT and BOOLEAN column data type values are displayed. They now display as true or false (4.17 GA behavior in snapsmrc515) rather than converting to 0 or 1 values (4.17-patch behavior).
4.17 PatchMULTIPLE7479 Latest

Fixed an issue with the SQL Server - Lookup Snap wherein it fails a UUID search.


Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

  • Fixed an issue with the SQL Server Execute Snap wherein the Snap would send the input document to the output view even if the Pass through field is not selected in the Snap configuration. With this fix, the Snap sends the input document to the output view, under the key original, only if you select the Pass through field.
  • Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16 Patch

 db/sqlserver6981 Latest

Fixed an issue of slow performance in SQL Server Snaps while using SQL Server Dynamic account type. 

4.16 Patch db/sqlserver6818 Latest

Fixed an issue with the Lookup Snap passing data simultaneously to output and error views when some values contained spaces at the end.

StableUpgraded with the latest SnapLogic Platform release.

4.15 Patch

 db/sqlserver6337 Latest

Replaced Max idle time and Idle connection test period properties with Max life time and Idle Timeout properties respectively, in the Account configuration. The new properties fix the connection release issues that were occurring due to default/restricted DB Account settings.

StableUpgraded with the latest SnapLogic Platform release.

4.14 Patch 

db/sqlserver5912 Latest

Fixed an issue to parse the right data type and display it in the input schema for SQL Server Snap..

4.14 Patch 

db/sqlserver5665 Latest

Implemented a connection retry logic in the SQL Server account to resolve the connection loss issue in a customer's org.

StableUpgraded with the latest SnapLogic Platform release.


StableUpgraded with the latest SnapLogic Platform release.


StableUpgraded with the latest SnapLogic Platform release.

4.11 Patch 

db/sqlserver4388 Latest

Fixed an issue with the Stored Procedure Snap that does not maintain the columns' order on the output as per table's definition.

4.11 Patch

 db/sqlserver4288 Latest

 SQL Server Snap Pack - Fixed an issue when inserting a valid NaN value into a column.

StableUpgraded with the latest SnapLogic Platform release.

4.10 Patch

sqlserver3953 Latest

Fixed an issue where the SQL Server Stored Procedure gets hanged when more than one Snap existed in the pipeline each processing greater than 1K documents.




Added Auto commit property to the Select and Execute Snaps at the Snap level to support overriding of the Auto commit property at the Account level.

4.9.0 Patch

sqlserver3224 Latest

Addressed an issue with SQL Server - Bulk Load execution even with 0 input documents

4.9.0 Patch

sqlserver3076 Latest

Fixed an issue regarding connection not closed after login failure; Expose autocommit for "Select into" statement in PostgreSQL Execute Snap and Redshift Execute Snap

StableUpgraded with the latest SnapLogic Platform release.

4.8.0 Patch

sqlserver2803 Latest

Addressed an issue with slow performance with Bulk Load BCP.

4.8.0 Patch

sqlserver2761 Latest

Potential fix for JDBC deadlock issue.

4.8.0 Patch

sqlserver2706 Latest

Fixed SQL Server Snap Pack rendering dates that are one hour off from the date returned by database query for non-UTC Snaplexes.



StableUpgraded with the latest SnapLogic Platform release.


  • Extended support for SQL Server Dynamic accounts.
  • Updated the SQL Server Stored Procedure Snap with the Pass through field. 
  • Resolved an issue in SQL Server Bulk Load Snap that caused BCP program related failures.
  • Enhanced to fully support SQL statements with/without expressions & SQL bind variables.
  • Resolved an issue that caused failures when executing merge statements.


LatestUpgraded with the latest SnapLogic Platform release.


  • Resolved an issue in SQL Server Execute Snap that erroneously reported a database/schema mismatch during Snap/pipeline execution.
  • Resolved an issue in SQL Server Lookup Snap that occurred when handling case-insensitive field values.
4.4.1NA Latest
  • Introduced the SQL Bulk Load in this release.