> For the complete documentation index, see [llms.txt](https://docs.euno.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.euno.ai/sources/data-warehouses/sql-server-integration.md).

# SQL Server

Euno's SQL Server integration connects to Microsoft SQL Server and Azure SQL Database to discover databases, schemas, tables, views, columns, lineage, and Query Store usage.

The integration supports one source type for both:

* On-premises Microsoft SQL Server 2016 and later
* Azure SQL Database

## Setting up SQL Server integration

### Overview

SQL Server stores data in databases. Each database contains schemas, and each schema contains tables, views, indexed views, and columns.

Euno connects to SQL Server through Microsoft ODBC Driver 18 and reads system catalog views, `INFORMATION_SCHEMA`, and Query Store metadata. System databases (`master`, `tempdb`, `model`, and `msdb`) and system schemas are excluded from discovery.

### Step 1: Prepare SQL Server

#### Ensure SQL Server is reachable

1. Confirm that Euno can reach the SQL Server host and port. The default port is `1433`.
2. For on-premises SQL Server, allow inbound traffic from the Euno runtime network or through your private connectivity setup.
3. For Azure SQL Database, allow the Euno runtime through the Azure SQL firewall or use a Private Endpoint/private networking path.
4. Note the hostname, port, and initial database. The default initial database is `master`.

#### Choose an authentication method

SQL Server authentication and Microsoft Entra client credentials are mutually exclusive. Euno selects the authentication method from the populated credential fields:

* SQL authentication: provide **SQL Username** and **SQL Password**.
* Entra client credentials: provide **Entra Tenant ID**, **Entra Client ID**, and **Entra Client Secret**.

Do not populate both credential families for the same source.

### Step 2: Grant permissions

Use a dedicated SQL Server login or Entra application for Euno. The account must be able to connect to each database you want Euno to discover.

Minimum permissions depend on which features you enable:

| Permission                                                            | Used for                                                                    |
| --------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Catalog visibility for databases, schemas, tables, views, and columns | Core metadata discovery                                                     |
| `VIEW DEFINITION`                                                     | View definitions, computed column definitions, and definition-based lineage |
| `VIEW DATABASE STATE`                                                 | Query Store usage and workload lineage                                      |
| Permissions to read size and row-count metadata                       | Table row counts and storage size metadata                                  |

For Query Store usage and workload lineage, each database must have Query Store enabled and readable by the Euno account.

### Step 3: Enable Query Store for usage and workload lineage

Query Store is required for SQL Server usage metrics and workload lineage. If Query Store is disabled or read-only metadata is unavailable for a database, Euno still discovers catalog resources for that database, but it skips Query Store usage and workload lineage for that database.

For on-premises SQL Server 2016-2019, Query Store is often disabled by default. Enable it per database:

```sql
ALTER DATABASE [<database_name>] SET QUERY_STORE = ON;
```

Azure SQL Database commonly has Query Store enabled, but you should verify it for the databases you want to observe.

Query Store does not provide reliable per-user attribution for Euno's SQL Server usage model, so this integration does not emit per-user usage metrics.

### Step 4: Configure Euno's SQL Server source

| Configuration       | Description                                                                               |
| ------------------- | ----------------------------------------------------------------------------------------- |
| SQL Server Hostname | SQL Server hostname, named instance host, or Azure SQL hostname. Do not include protocol. |
| SQL Server Port     | SQL Server TCP port. Defaults to `1433`.                                                  |
| Initial Database    | Initial database used for connection setup. Defaults to `master`.                         |
| SQL Username        | Username for SQL authentication. Required when using SQL authentication.                  |
| SQL Password        | Password for SQL authentication. Required when using SQL authentication.                  |
| Entra Tenant ID     | Microsoft Entra tenant ID. Required when using Entra client credentials.                  |
| Entra Client ID     | Microsoft Entra application/client ID. Required when using Entra client credentials.      |
| Entra Client Secret | Microsoft Entra client secret. Required when using Entra client credentials.              |

### Step 5: Schedule

1. Enable the Schedule option.
2. Choose:
   1. **Weekly**: Set specific days and times.
   2. **Hourly**: Define the interval in hours.

### Step 6: Resource Cleanup

* **Immediate Cleanup**: Remove resources not detected in the most recent successful source integration run.
* **No Cleanup**: Keep all resources indefinitely, even if they are no longer detected.

For a detailed explanation on Euno's cleanup strategies, see [Resource Sponsorship in Euno](/developer-reference/technical-concepts/resource-sponsorship-and-cleanup-in-euno.md).

### Step 7: Advanced Settings

Click **Advanced** to display these additional settings.

| Configuration                                                      | Description                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Encrypt Connection                                                 | Encrypt the SQL Server connection. Azure SQL usually requires this enabled.                                                                                                                                                                                                                             |
| Trust Server Certificate                                           | Trust the server certificate without normal certificate-chain validation. Use only when SQL Server presents a self-signed or private-CA certificate that Euno cannot otherwise validate.                                                                                                                |
| Override SQL Server Instance Name                                  | Custom display name for the SQL Server instance in Euno. Defaults to the hostname.                                                                                                                                                                                                                      |
| Override SQL Server Hostname for URIs                              | Stable hostname used in generated `mssql.` URIs. By default, Euno preserves the configured hostname and any named instance. Use this override when the connection hostname is not the canonical warehouse hostname or when matching existing external references that use a short host such as `sql01`. |
| Extract Row Counts and Sizes                                       | Read row-count and storage-size metadata. If this metadata is unavailable, Euno still discovers catalog resources and omits the row-count and size fields.                                                                                                                                              |
| Extract Query Store Usage                                          | Read Query Store to emit table usage counts and last access/write timestamps.                                                                                                                                                                                                                           |
| Extract Query Store Lineage                                        | Read Query Store plans and SQL text to infer workload table lineage.                                                                                                                                                                                                                                    |
| Send Raw Query Store SQL to Eunolizer When Plan XML Is Unavailable | Optional fallback for lineage parsing. Disabled by default because Query Store can contain ad-hoc SQL with sensitive literals.                                                                                                                                                                          |
| Query Store Lookback Days                                          | Number of days to read from Query Store. Defaults to `30`.                                                                                                                                                                                                                                              |
| Max Query Store Queries Per Database                               | Per-database safety cap for Query Store workload processing. Defaults to `100000`.                                                                                                                                                                                                                      |
| Database Pattern                                                   | Regular expressions to include or exclude user databases. System databases are always excluded.                                                                                                                                                                                                         |
| Schema Pattern                                                     | Regular expressions to include or exclude schemas. SQL Server system schemas are always excluded.                                                                                                                                                                                                       |
| Local Agent                                                        | Select a local agent to route traffic through when your SQL Server instance is inside a private network. See [Local Agents](/setup-configuration/account-settings/local-agents.md) for setup instructions.                                                                                              |

### Step 8: Save Configuration

Click **Test & Save** to validate the connection and permissions before saving.

## Discovered Resources

For detailed information about discovered resources, properties, relationships, and URI patterns, see [SQL Server Integration Discovered Resources](/sources/data-warehouses/sql-server-integration/sql-server-integration-discovered-resources.md).


---

# 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.euno.ai/sources/data-warehouses/sql-server-integration.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.
