> For the complete documentation index, see [llms.txt](https://docs.wobby.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wobby.ai/connections/connect-a-data-source/microsoft-sql-server-ms-sql.md).

# Microsoft SQL Server (MS SQL)

Follow this guide to connect your Microsoft SQL Server to Actian AI Analyst and start building agents on top of your data.

To connect your Microsoft SQL Server database to Actian AI Analyst, you'll need to:

1. Create a **login and user** in your SQL Server.
2. Grant the necessary **read-only permissions**.
3. Allow **Actian AI Analyst's IP address** through your firewall or network rules.
4. Set up the connection in the **Actian AI Analyst interface**.

> ⚠️ **Actian AI Analyst's agents only run read-only queries** on your data. Write permissions are never used.

***

### 1. Create Login and User in SQL Server

You'll need to create a server-level login and a database-level user that Actian AI Analyst can use to connect. The following SQL script sets up a read-only user for Actian AI Analyst:

```sql
-- Replace placeholder values with your actual database, schema, and password.

-- Create server-level login
CREATE LOGIN analyst_login WITH PASSWORD = '<your_secure_password>';

-- Switch to your target database
USE YourDatabaseName;

-- Create a database-level user linked to the login
CREATE USER analyst_user FOR LOGIN analyst_login;

-- Grant read-only access to all tables
ALTER ROLE db_datareader ADD MEMBER analyst_user;

```

> ✅ The `db_datareader` role gives read-only access to **all current and future tables** in the database.

### 3. Allow Actian AI Analyst's IP Address

If your SQL Server is behind a firewall or uses network policies, make sure to allow inbound traffic from Actian AI Analyst's static IP:

```
34.77.172.158
```

> This is required for Actian AI Analyst's agents to access your database.

### 4. Set Up the Connection in Actian AI Analyst

1. Click **Connections → Plus button → Select MS SQL**.
2. Fill in the following details:
   * **Host**: your SQL Server address
   * **Port**: typically 1433
   * **Database name**: the one where `analyst_user` has access
   * **Username**: `analyst_login`
   * **Password**: the password you defined earlier
3. Test the connection and save.


---

# 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.wobby.ai/connections/connect-a-data-source/microsoft-sql-server-ms-sql.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.
