SQL Server Insert Writer - Haufe-Lexware/haufe.no-frills-transformation GitHub Wiki

Inserting data on an SQL Server database

In order to insert data on an SQL Server database, use the following target definition:

<Target config="[configuration]">sqlserver.insert://table_name</Target>

The SQL Server Update Writer will attempt to insert the records into the table_name (the name of the table to insert data to). It will do a best effort to map the output fields to the actual SQL Server records.

For the configuration, there are two possibilities:

  • Using a connection string directly
  • Using a connection string which is located in a text file

Using a connection string directly

Pass the connection string directly into the configuration of the source tag:

<Target config="Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;">sqlserver.insert://CreditStatements</Target>

Parameters can be used inside the connection string, if needed.

Please note the use the substitution of the greater (>, &gt;) operator in the SQL query (needed for XML compliance).

Using a connection string inside a text file

In order to read the connection string from a file, use the following syntax (using the @ character):

<Target config="@sqlserver_connection.txt">sqlserver.insert://Contacts</Target>

Sample content of the sqlserver_connection.txt file, also using a parameter (§env§):

Server=§env§;Database=myDataBase-§env§;User Id=myUsername;Password=myPassword;

Sample Connection Strings

See https://www.connectionstrings.com/sql-server/

⚠️ **GitHub.com Fallback** ⚠️