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

# Microsoft SQL Server

> Connect Datafold to Microsoft SQL Server for data diffing, reconciliation, and migration validation. Includes setup instructions and required permissions.

> [!NOTE]
>
> **INFO**
>
> Column-level Lineage is not currently supported for Microsoft SQL Server.

**Steps to complete:**

1. [Run SQL script and create schema for Datafold](https://docs.datafold.com/classic/integrations/databases/sql-server.md#run-sql-script-and-create-schema-for-datafold)
2. [Configure your data connection in Datafold](https://docs.datafold.com/classic/integrations/databases/sql-server.md#configure-in-datafold)

## Run SQL script and create schema for Datafold

To connect to Microsoft SQL Server, create a user with read-only access to all tables you wish to diff. Include read and write access to a Datafold-specific temp schema:

```Bash theme={null}
/* Select the database that will contain the temp schema */
USE DatabaseName;

/* Datafold utilizes a temporary dataset to materialize scratch work and keep data processing in your warehouse. */
CREATE SCHEMA datafold_tmp;

/* Create the Datafold user */
CREATE LOGIN DatafoldUser WITH PASSWORD = 'SOMESECUREPASSWORD';
CREATE USER DatafoldUser FOR LOGIN DatafoldUser;

/* Allow the user to create views */
GRANT CREATE VIEW TO DatafoldUser;

/* Allow the user to create tables */
GRANT CREATE TABLE TO DatafoldUser;

/* Grant read access to diff tables */
GRANT SELECT ON SCHEMA::YourSchema TO DatafoldUser;

/* Grant read + write access to datafold_tmp schema */
GRANT CONTROL ON SCHEMA::datafold_tmp TO DatafoldUser;
```

## Configure in Datafold

| Field Name | Description |
| - | - |
| Connection name | A name given to the data connection within Datafold |
| Host | The hostname for your SQL Server instance |
| Port | SQL Server connection port; default value is 1433 |
| Username | The user created in our SQL script, named DatafoldUser |
| Password | The password created in our SQL script |
| Database | The name of the SQL Server database you want to connect to |
| Dataset for temporary tables | The schema created in our SQL script, in database.schema format: DatabaseName.datafold\_tmp in our script above. |
| Require encryption | Encrypt the connection. On by default. |
| Trust server certificate | Accept the server's certificate without validation. On by default. |
| Always On Availability Group | Enable only when connecting to an Always On Availability Group listener. Requires encryption. |

Click **Create**. Your data connection is ready!


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.