# Microsoft SQL Server

{% hint style="info" %}
You can also use this document to connect **Azure SQL Server** to Decube.
{% endhint %}

## Supported Capabilities

{% tabs %}
{% tab title="Supported Capabilities" %}
**General**

* **Metadata** — metadata extraction and display of asset information (tables, columns, schemas). Types collected: Schema, Table, Column
* **Profiling** — data profiling on the Profiler tab
* **Preview** — sample data preview
* **Data Quality** — data quality monitoring and observability

**Data Quality Monitors**

* Freshness
* Volume
* Field Health
* Custom SQL
* Schema Drift

**Lineage**

* **Foreign Key Lineage** — tracks relationships between tables via primary and foreign keys
  {% endtab %}

{% tab title="Not Supported" %}
**General**

* Configurable Collection
* External Table
* View Table
* Stored Procedure

**Data Quality Monitors**

* Job Failure

**Lineage**

* View Table Lineage
* External Table Lineage
* SQL Query Lineage
* Stored Procedure Lineage
  {% endtab %}
  {% endtabs %}

## Connection Requirements

Connecting to decube is as easy as providing us with credentials to your Microsoft SQL database. At a minimum, we require

* `username`
  * If connecting to AzureSQL using SSH, use `username@<servername>.database.windows.net`
* `password`
* `host address`
  * If connecting to AzureSQL, use fully qualified name e.g. `<servername>.database.windows.net`
* `host port`
* `database name`

<figure><img src="/files/E7h7ep7tqkjwhDJdjvEz" alt=""><figcaption><p>Microsoft SQL Server</p></figcaption></figure>

The `source name` will be for you to differentiate and recognize particular sources within the decube application.

We strongly encourage you to create a decube **read-only** user for this credential purpose, which you can follow [here](https://github.com/DecubeIO/decube_docs/blob/master/databases/mssql.md#custom-user-for-decube).

### **Security Concerns**

If access to your database is protected by security measures, we allow for connecting via [SSH Tunneling](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access/ssh-tunneling) or you could [whitelist our IP](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access/ip-whitelisting). See more [here.](https://docs.decube.io/how-to-connect-data-sources/enabling-vpc-access)

{% hint style="info" %}
To connect to Azure SQL through an SSH tunnel, you must explicitly provide the server context. Azure's gateway requires the following configuration to route the request correctly:

* Host: Use the fully qualified domain name: `<servername>.database.windows.net`.
* Username: Use the format `username@<servername>.database.windows.net`.
  {% endhint %}

### **Custom User for decube**

A custom user would allow for a granular configuration of the user on your database and your connection to decube.

1. Create a New User for decube

```sql
CREATE LOGIN [decube] WITH PASSWORD=N'your_password';
```

2. Execute the following SQL statement to create a new database user and map it to the login created in the previous step

```sql
USE your_db_name;
CREATE USER [decube] FOR LOGIN [decube];
```

3. Add the user to role db\_datareader

```sql
EXEC sp_addrolemember N'db_datareader', N'decube'
```


---

# Agent Instructions: 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:

```
GET https://docs.decube.io/databases/microsoft-sql-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
