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

# SQL Server

### Creating a Data Source for SQL Server in TrustLogix

#### Prerequisite Steps

1. **Download Required Files**:
   * Click on the **Download** button to obtain the zip file containing the necessary SQL scripts.
2. **Execute SQL Scripts**:
   * Use **SQL Server Management Studio (SSMS)** to execute the following SQL scripts from the downloaded zip file:
     * `tlx_sqlserver_grants.sql`
     * `tlx_sqlserver_grants_for_aws_rds.sql`
   * Ensure the scripts are run on the appropriate SQL Server instance.
3. **Capture Configuration Details**:
   * Note down the following details:
     * Username and password used in the SQL grants scripts.
     * Hostname and port of the SQL Server.
4. **Understand TrustLogix User Grants**:
   * The TrustLogix user will be granted the following permissions:
     * `CONNECT`, `ALTER`, `ALTER ANY MASK`, `ALTER ANY SECURITY POLICY` on all existing databases for masking and row access policies.
     * `SELECT`, `ALTER`, `EXECUTE`, `CREATE FUNCTION`, `CREATE TABLE` on `TLX_POLICY_DB` for masking and row access policies.
   * The TrustLogix user will also be added as a member of the `db_securityadmin` role for each database.

#### Connection Configuration

1. **Server Name and Port**:
   * Enter the hostname of the SQL Server instance in the format `ServerName,1433` (replace `1433` with the actual port if different).
   * Refer to the guide: *How to obtain the server name?*
2. **Username**:
   * Provide the username captured from the grants script execution.
3. **Password**:
   * Enter the password corresponding to the username.

#### Final Step

* After populating all the fields, click **Save** to complete the registration of the SQL Server data source.


---

# 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.trustlogix.io/data-sources/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.
