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

# SQL Server

> Connect BonData to Microsoft SQL Server to sync your database tables

Microsoft SQL Server is a relational database management system widely used in enterprise environments, offering strong integration with the Microsoft ecosystem. With BonData, you can connect directly to your SQL Server database to read, enrich, and act on your data within Agent workflows.

## Database Connection

BonData connects directly to your SQL Server database using standard connection credentials.

### Step 1: Prepare Your Database

Ensure your SQL Server is accessible from BonData's IP addresses. You may need to:

1. Configure your firewall to allow connections on port 1433 (or your custom port)
2. Enable TCP/IP connections in SQL Server Configuration Manager
3. Ensure SQL Server authentication is enabled (mixed mode)

### Step 2: Create a Read-Only User (Recommended)

For security, create a dedicated read-only user for BonData:

```sql theme={null}
-- Create a login
CREATE LOGIN bondata_user WITH PASSWORD = 'your_secure_password';

-- Create a user in your database
USE your_database;
CREATE USER bondata_user FOR LOGIN bondata_user;

-- Grant read access
ALTER ROLE db_datareader ADD MEMBER bondata_user;
```

### Step 3: Gather Connection Details

Collect the following information:

* **Host**: Your database server hostname or IP address
* **Port**: Usually 1433
* **Database**: The name of the database to connect to
* **User**: The username created above
* **Password**: The password for the user

### Step 4: Connect in BonData

Enter your connection details in BonData to establish the connection.

## Required Fields

| Field    | Description                            |
| -------- | -------------------------------------- |
| Host     | Database server hostname or IP address |
| Port     | Database server port (default: 1433)   |
| Database | Name of the database to connect to     |
| User     | Database username                      |
| Password | Database password                      |

<Note>
  BonData supports encrypted connections using TLS. This is recommended for production environments.
</Note>

## Available Data

Once connected, BonData can sync:

* **Tables** - All tables the user has SELECT access to
* **Views** - Database views accessible to the user
* **Custom Queries** - Run custom SQL queries to extract specific data
