Skip to content
Components Updated November 27, 2026

SQL Server

Write Keboola tables to a Microsoft SQL Server database, map columns to SQL Server types, choose full or incremental load, and see how binary values convert.

This data destination connector sends data to a Microsoft SQL Server (opens in a new tab) database.

Before you start

You need

  • A SQL Server database and a SQL Server login for the connector, with a user in that database whose default schema is the schema to write to. The user needs CREATE TABLE, and ALTER, SELECT, INSERT, UPDATE and DELETE on the schema. Create a dedicated user has the SQL for such a login.
  • On Azure SQL, SQL authentication turned on, because the connector logs in with a SQL login and password.
  • Network access from Keboola to the database: allow the Keboola IP addresses of your stack in your firewall (on Azure SQL, a server firewall rule), or connect through an SSH tunnel.

What each tab needs

  • Prompt tab Kai, the Kai Agent button in the top bar, on supported stacks. A new Free Plan project has it from the start; elsewhere an organization admin turns it on once: Get started with Kai.
  • UI tab a browser.
  • CLI / API tab kbagent, connected to your project. The checks only read.

We highly recommend that you create dedicated credentials for the connector in your database. You can use the following SQL code to get started:

CREATE LOGIN writer_sample WITH PASSWORD = 'Writer_sample1';
CREATE DATABASE writer_sample;
USE writer_sample;
CREATE SCHEMA writer_sample_schema;
CREATE ROLE writer_sample_role;
CREATE USER writer_sample FROM LOGIN writer_sample WITH DEFAULT_SCHEMA=writer_sample_schema;
GRANT EXECUTE, CREATE TABLE TO writer_sample_role;
GRANT ALTER, SELECT, INSERT, UPDATE, DELETE ON SCHEMA :: writer_sample_schema TO writer_sample_role;
ALTER ROLE writer_sample_role ADD MEMBER writer_sample;

Create a new configuration of the SQL Server data destination connector.

The first step is to Set Up Database Credentials. You need to provide a host name, user name, password, database name, and SQL Server version; optionally, an instance name if needed for the connection.

Screenshot - Save Credentials

The next step is to configure the tables to write. Click the Add new table button and select an existing table from Storage:

Screenshot - Select Table

The credentials form has no schema field, so table names without a schema land in the user’s default schema (WITH DEFAULT_SCHEMA in the SQL above). To write elsewhere, give the table name as schema.table.

The next step is to specify table configuration. Use the preview icon to peek at the column contents.

Screenshot - Table Columns

For each column you can specify its

  • name in the destination database; you can also use the select box in the table header to bulk convert the case of all names.
  • data type (one of SQL Server data types (opens in a new tab)); you can also use the select box in the table header to bulk set the type for all columns. Setting the data type to IGNORE means that column will not be present in the destination table.
  • nullable; when checked, the column will be marked as nullable and empty values ('') in that column will be converted to NULL. Use this for non-string columns with missing data.
  • default value; the provided value will be set as the default value of the column (opens in a new tab) in the target table.

When done configuring the columns, don’t forget to save the settings.

At the top of the page, you can specify the target table name and additional load options. There are two main options how the data destination connector can write data to tables — Full Load and Incremental Load.

Screenshot - Table Options

In the Incremental Load mode, the data are bulk inserted into the destination table and the table structure must match (including the data types). That means the structure of the target table will not be modified. If the target table doesn’t exist, it will be created. If a primary key is defined on the table, the data is upserted (opens in a new tab). If no primary key is defined, the data is inserted.

In the Full Load mode, the table is completely overwritten including the table structure. The table is removed using the DROP (opens in a new tab) command and recreated. The DROP command needs to acquire a table-level lock (opens in a new tab). This means that if the database is used by other applications which acquire table-level locks, the connector may freeze waiting for the locks to be released.

Additionally, you can specify a Primary key of the table, a simple column Data filter, and a filter for incremental processing.

Don’t forget to Save the configuration, then click Run Component.

Check:

Prompt
Did the last job of the SQL Server data destination configuration my-sql-server-config end with success? Give its end time.

Kai only reads here, so it asks for no approval, and its answer links to what it found in your project.

For binary types binary, varbinary, image, the following rules apply:

  • If value starts with 0x and length of the value is even number, then it is a HEX value according to the MsSQL specification (style 1) (opens in a new tab).
    • Example: "0xabcdef" is converted to binary value 0xabcdef.
  • Else, the value is a string. MsSQL adds separator \0 after each char code, when storing string as the binary type.
    • Example: "0xabcde" is converted to binary value 0\0x\0a\0b\0c\0d\0e.
    • Example: "dog" is converted to binary value d\0o\0g\0.
Ask Kai

Hi, I'm Kai — Keboola's AI assistant for the docs. Ask me anything and I'll answer from the documentation and cite the pages I use.

Kai is an AI and can make mistakes. Check the sources it links.