# 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.
