> For the complete documentation index, see [llms.txt](https://docs.osmos.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.osmos.io/destination-connectors/microsoft-sql-server.md).

# Microsoft SQL Server

## Overview

You can create a Microsoft SQL Server Destination Connector to write to a Microsoft SQL table by using your username and password.&#x20;

The schema for this Destination Connector is defined by the Microsoft SQL table schema.

## Prerequisites

Required information:

* Host
* Port&#x20;
* Username
* Password
* Database
* SQL Server URL (Optional)
* Table

## Creating an Microsoft SQL **D**estination Connector

**Step 1:** After selecting **+ New Connector**, under the **System** prompt, click **Microsoft SQL Server.**

![](/files/cZmA7pQcEuEXz7xnKq8m)

**Step 2:** Provide a **Connector Name.**

**Step 3:** Select **Destination Connector.**

**Step 4:** Provide the **Host Name.**&#x20;

**Step 5:** Provide the **Port Number.**

**Step 6:** Provide your **Username.**

**Step 7:** Provide your **Password.**

**Step 8:** Provide the name of the **Database** that contains the table where data should be written.&#x20;

{% hint style="info" %}
If you are trying to access a database that is behind a firewall, please ensure that the following Osmos IP addresses are allowed to access the database. Osmos uses these fixed IP addresses to access your sources and destinations.&#x20;

* `35.222.106.198/32`
* `35.232.180.174/32`
  {% endhint %}

**Step 9:** Note, this field is optional and in most cases is **best avoided**. If your server instance is specifically configured, you may provide the **SQL Server URL** used to connect to your instance of Microsoft SQL Server, contact support for further details.

**Step 10:** Three display options are provided for tables within your database:

* Tables: If this option is selected, only tables will be displayed to connect to.
* Views: If this option is selected, only views will be displayed to connect to.
* Both: If this option is selected, both tables and views will be listed as valid connection options.

**Step 11:** Select the way you want like to enter data into SQL Server.&#x20;

* **Insert** simply adds rows to the system
* **Upsert** first checks if the row exists - If it does it updates it, otherwise it inserts the row

**Step 12:** Provide the name of the **Table** where data should be written.

{% hint style="info" %}
**Note:** the schema for this Destination Connector is defined by the Microsoft SQL Server table schema.&#x20;
{% endhint %}

{% hint style="info" %}
**Note:** for any fields that have primary key, foreign key or other constraints, you may either (1) ensure that the source data mapped to the field satisfies those constraints or (2) leave the field empty and ensure that your database is set up to auto populate those fields with appropriate constraint-satisfying data.
{% endhint %}

## Advanced Options

#### Validation Webhook

We support the use of Validation Webhooks to prevent bad data from being written to your systems, adding another layer of protection to the built-in validations that Osmos provides. The Webhook URL can be posted here.

{% hint style="info" %}
For more information on Validation Webhook configuration, see [Server Side Validation Webhooks](/developer-docs/validation-and-transformation-webhooks.md)
{% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.osmos.io/destination-connectors/microsoft-sql-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
