> ## Documentation Index
> Fetch the complete documentation index at: https://support.entegrata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft SQL Server

> How to emit data from Entegrata to a Microsoft SQL Server database

## Overview

Emit collected data from Entegrata into any Microsoft SQL Server database — on-premise, Azure SQL Database, Azure SQL Managed Instance, or Amazon RDS for SQL Server.

**Destination type:** SQL database

## Before You Start

* Ask your DBA for a **service account** on the target database that can write to the emission schema
* Pick (or create) a target schema where Entegrata can create and manage tables
* Make sure the SQL Server is reachable from Entegrata ([firewall / private-link rules](/administration/instance/overview))

### Required Permissions

Grant the service account:

* `SELECT`, `INSERT`, `UPDATE`, `DELETE` on the target schema
* `CREATE TABLE`, `ALTER`, and `DROP` on the target schema (so Entegrata can create staging tables, apply schema changes, and swap tables during Full Refresh)
* `VIEW DEFINITION` on existing objects in the schema

<Warning>
  Entegrata manages the lifecycle of the tables it emits — it creates, drops, and swaps them as part of normal operation. Dedicate an emission schema rather than sharing one with tables maintained by other systems.
</Warning>

## Connection Details

<ResponseField name="Host" type="string" required>
  SQL Server hostname or IP address.

  Examples: `sqlserver.company.com`, `10.20.30.40`, `my-instance.database.windows.net`
</ResponseField>

<ResponseField name="Port" type="number">
  TCP port. Leave blank to use the default (`1433`). Azure SQL Managed Instance's public endpoint typically uses `3342`.
</ResponseField>

<ResponseField name="Database" type="string" required>
  Name of the target database.
</ResponseField>

<ResponseField name="Target Schema" type="string" required>
  Schema inside the database where emitted tables live. Defaults to `dbo`.
</ResponseField>

<ResponseField name="Encrypt Connection" type="boolean" default="true">
  Encrypt the connection in transit. Enabled by default. Only disable for legacy servers that cannot negotiate encryption.
</ResponseField>

## Authentication

Pick the method that matches how your SQL Server is configured.

<Note>
  **Entra ID** and **Entra Service Principal** are only available for SQL Servers hosted in Azure (Azure SQL Database, Azure SQL Managed Instance, or SQL Server running on Azure VM / Arc with Entra authentication enabled). See [Azure Entra ID Authentication](/data/collector/connections/entra-authentication) for the setup steps.
</Note>

<Tabs>
  <Tab title="SQL Authentication">
    Standard SQL login with a username and password.

    <ResponseField name="Username" type="string" required>
      SQL Server login with write access to the target schema.
    </ResponseField>

    <ResponseField name="Password" type="string" required>
      Password for the login (encrypted at rest).
    </ResponseField>
  </Tab>

  <Tab title="Entra Service Principal">
    Application-based authentication using an Azure AD app registration.

    <ResponseField name="Tenant ID" type="string" required>
      Azure AD tenant (directory) ID.
    </ResponseField>

    <ResponseField name="Client ID" type="string" required>
      Application (client) ID of the Azure AD app registration.
    </ResponseField>

    <ResponseField name="Client Secret" type="string">
      Client secret from the app registration. Provide **either** a secret **or** a certificate.
    </ResponseField>

    <ResponseField name="Client Certificate" type="string">
      PEM-encoded client certificate. Provide **either** a secret **or** a certificate.
    </ResponseField>

    <Warning>
      Service principal secrets and certificates expire. Set the **Secret Expiration** field on the connection so you're notified before they do.
    </Warning>
  </Tab>

  <Tab title="Entra ID">
    Passwordless authentication using the managed identity Entegrata uses in Azure. No credentials are entered — the managed identity must be granted write access to the target schema.

    <Note>
      Entra ID (managed identity) authentication is only available for self-hosted instances. Entegrata-hosted instances must use the Service Principal option.
    </Note>
  </Tab>
</Tabs>

## Write Modes

* **Full Refresh** — Entegrata loads all rows into a staging table and atomically swaps it with the target table. Any indexes, unique keys, and foreign keys you've added to the target are captured beforehand and reapplied after the swap.
* **Incremental Merge** — Entegrata writes only rows that changed in the source since the last emission, using the target's primary key to apply inserts, updates, and deletes in a single `MERGE`.

Entegrata picks the mode automatically on each emission — Full Refresh for the first run or when the schema changes materially, Incremental Merge for subsequent runs.

## Naming Convention

Emitted table and column names are transformed to match the convention configured on the emitter (default: `snake_case`). Configure the convention per emitter to match the downstream tools consuming the replica.
