> For the complete documentation index, see [llms.txt](https://docs.coupler.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coupler.io/destinations/categories/database/microsoft_sql_server.md).

# Microsoft SQL Server

Send data to Microsoft SQL Server 2017 or later with Coupler.io, with typed columns, Replace or Append mode, and configurable connection encryption.

Microsoft SQL Server is Microsoft's relational database, run on your own servers or in the cloud. With the Microsoft SQL Server destination, Coupler.io loads data from any supported source into a table in your SQL Server database on a schedule, so you can query it with SQL, Power BI, or any tool that connects to SQL Server.

{% hint style="info" %}
For Azure SQL Database, use the [Azure SQL](https://docs.coupler.io/destinations/categories/database/azure_sql.md) destination. It also supports Microsoft Entra ID sign-in.
{% endhint %}

## Why use Microsoft SQL Server as a Coupler.io destination?

* **Your existing SQL Server** — load data into the database your reports and applications already use
* **Typed columns** — Coupler.io creates the table with proper SQL Server types (numbers, dates, date-times, booleans), not text only
* **Encryption you control** — choose how the connection is encrypted and whether the server certificate is validated
* **Replace or Append** — keep a fresh snapshot, or build history by adding rows on every run
* **Any source, one database** — combine data from Google Ads, HubSpot, QuickBooks, Stripe and other sources in one database

## Prerequisites

* SQL Server **2017 or later**, reachable from the internet over TCP (default port `1433`)
* **SQL Server authentication** enabled on the server (mixed mode). Windows authentication isn't supported.
* A SQL Server login and database user for Coupler.io with these permissions in the target database:
  * **INSERT** on the target table or schema — needed in every mode
  * **CREATE TABLE** and **ALTER** on the schema — needed when Coupler.io creates or replaces the table
  * **CREATE SCHEMA** — only if you want Coupler.io to create a new schema
* Inbound connections allowed from the Coupler.io IP addresses:
  * `34.123.243.115`
  * `34.170.96.92`

See [Microsoft SQL Server Connection Setup](https://docs.coupler.io/destinations/categories/database/microsoft_sql_server/connection-setup.md) for step-by-step instructions, including the SQL to create the user.

## How to connect

{% stepper %}
{% step %}
**Create a data flow and add your source.** On **Data flows**, click **Create**, choose **Start from scratch**, and configure any source Coupler.io supports.
{% endstep %}

{% step %}
**Select Microsoft SQL Server as your destination.** In the **Destinations** step, choose **Microsoft SQL Server** and select the data set you want to send.
{% endstep %}

{% step %}
**Connect your SQL Server account.** Click **+ Add account** and fill in:

* **Host** — host name, IPv4 or IPv6 address of the server
* **Port** — default `1433`
* **Database** — the target database name
* **User** and **Password** — the SQL Server login for Coupler.io
* **Encrypt** — **Mandatory** by default; see [Connection encryption](https://docs.coupler.io/destinations/categories/database/microsoft_sql_server/connection-setup.md#connection-encryption)
* **Host name in certificate** and **Validate server certificate** — leave the defaults unless your server uses a self-signed certificate or a different certificate name

Click **Save**. The details are checked on the first run, not when you save the connection.
{% endstep %}

{% step %}
**Set the schema and table.** Enter the **Schema** (default `dbo`) and the **Table**. If they don't exist, Coupler.io creates them on the first run.
{% endstep %}

{% step %}
**Choose the import mode.**

* **Replace** — drops the table and creates it again with the latest data on every run
* **Append** — adds the new rows below the existing ones
  {% endstep %}

{% step %}
**Run the data flow.** Click **Save and run**. When the run succeeds, set up a schedule in **Flow settings**.
{% endstep %}
{% endstepper %}

## Supported features

| Feature                                 | Supported |
| --------------------------------------- | --------- |
| Replace mode                            | Yes       |
| Append mode                             | Yes       |
| Automatic scheduling                    | Yes       |
| Typed columns                           | Yes       |
| SQL Server authentication               | Yes       |
| Windows authentication                  | No        |
| Encryption: Strict, Mandatory, Optional | Yes       |
| SSH tunnel, VPN, private network        | No        |

### How data is written

| Coupler.io column type | SQL Server type                                                |
| ---------------------- | -------------------------------------------------------------- |
| String                 | `nvarchar(max)`                                                |
| Integer                | `bigint`                                                       |
| Decimal                | `float`                                                        |
| Boolean                | `bit`                                                          |
| Date                   | `date`                                                         |
| DateTime               | `datetime2` (values with a time zone offset are stored in UTC) |

All columns are created as nullable. Column names are made SQL-friendly: characters other than Latin letters, digits, `_` and `$` become `_` (`Country Name` → `Country_Name`), and a name starting with a digit gets a `_` prefix. If two names become the same (names are compared without case), each of them gets a number: `Test_name_1`, `test_name_2`.

In Append mode, Coupler.io doesn't add or change columns in an existing table. If the columns in your data change, run the data flow once in **Replace** mode, or add the new columns to the table yourself.

## Microsoft SQL Server common issues

### Connection issues

<details>

<summary>The run fails with "Failed to connect to … in 10000ms"</summary>

Coupler.io couldn't reach the server within 10 seconds. Check that:

* the **Host** and **Port** are correct
* SQL Server accepts TCP/IP connections on that port
* your firewall, cloud security group or router allows inbound connections from `34.123.243.115` and `34.170.96.92`

</details>

<details>

<summary>The run fails with "Login failed for user '…'"</summary>

The user name or password is wrong, or SQL Server authentication is turned off. Check the credentials, and make sure the server runs in **SQL Server and Windows Authentication mode**. See [Enable SQL Server authentication](https://docs.coupler.io/destinations/categories/database/microsoft_sql_server/connection-setup.md#enable-sql-server-authentication).

</details>

<details>

<summary>The run fails with "We could not connect to the provided database"</summary>

The database name is wrong, or the login has no user in that database. Check the **Database** field, and that the login was mapped to a user in the target database.

</details>

<details>

<summary>The run fails with "We could not set up an encrypted connection to your Microsoft SQL Server"</summary>

The server and Coupler.io didn't agree on encryption. Make sure the server supports TLS 1.2 or later and that the **Host** and **Port** point to SQL Server. **Strict** encryption needs SQL Server 2022 or later — on older versions, use **Mandatory**.

</details>

<details>

<summary>The run fails with "We could not verify the TLS certificate of your Microsoft SQL Server"</summary>

The server's certificate isn't issued by a trusted certificate authority, has expired, or doesn't match the host name. Install a valid certificate, or set **Host name in certificate** to the name in the certificate. For a self-signed certificate on a trusted network, set **Encrypt** to **Mandatory** and **Validate server certificate** to **No**.

</details>

<details>

<summary>The run fails with "A query to your Microsoft SQL Server did not complete in time"</summary>

Another session probably locks the destination table, for example an open transaction or a long-running query. Make sure no open transaction uses the table, and run the data flow again.

</details>

### Permission errors

<details>

<summary>"Cannot drop the table '…', because it does not exist or you do not have permission"</summary>

Replace mode drops the table before it creates it again. The user needs `ALTER` on the table's schema. This often happens when another user created the schema or table. Grant the permission:

```sql
GRANT ALTER ON SCHEMA::<schema> TO [<user>];
```

</details>

<details>

<summary>"CREATE TABLE permission denied" or "CREATE SCHEMA permission denied"</summary>

The user can't create the table or schema. Grant the missing permission, or create the table yourself and use **Append** mode:

```sql
GRANT CREATE TABLE TO [<user>];
GRANT ALTER, INSERT ON SCHEMA::<schema> TO [<user>];
GRANT CREATE SCHEMA TO [<user>];  -- only to let Coupler.io create new schemas
```

</details>

### Data issues

<details>

<summary>"The data does not match the table" with a column type</summary>

A column in the existing table has a type that can't hold the data, for example a `date` column that receives numbers. Use **Replace** mode to create the table again, or change the column type in the table.

</details>

## Microsoft SQL Server FAQ

<details>

<summary>Which Microsoft SQL Server versions does Coupler.io support?</summary>

SQL Server 2017 and later. **Strict** encryption (TDS 8.0) needs SQL Server 2022 or later.

</details>

<details>

<summary>Can I use the Microsoft SQL Server destination with Amazon RDS or Google Cloud SQL?</summary>

Yes, if the instance is reachable over the internet: make the instance publicly accessible and allow the Coupler.io IP addresses in its security group or authorized networks. For Azure SQL, use the [Azure SQL](https://docs.coupler.io/destinations/categories/database/azure_sql.md) destination.

</details>

<details>

<summary>Can I connect a SQL Server on a private network to Coupler.io?</summary>

Only if it accepts connections from the internet on its SQL Server port, from the IP addresses `34.123.243.115` and `34.170.96.92`. SSH tunnels and VPNs aren't supported.

</details>

<details>

<summary>Does Coupler.io create the SQL Server schema and table?</summary>

Yes. If the schema or table doesn't exist, Coupler.io creates it on the first run. The user needs `CREATE TABLE` and `ALTER` on the schema, and `CREATE SCHEMA` for a new schema.

</details>

<details>

<summary>Is the connection to Microsoft SQL Server encrypted?</summary>

By default, yes: **Encrypt** is **Mandatory**, so the connection is always encrypted and the server certificate is validated. You can choose **Strict** for TDS 8.0, or **Optional** to encrypt only when the server requires it. See [Connection encryption](https://docs.coupler.io/destinations/categories/database/microsoft_sql_server/connection-setup.md#connection-encryption).

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coupler.io/destinations/categories/database/microsoft_sql_server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
