MS SQL Server / Azure SQL Databases
ToolJet can connect to MS SQL Server & Azure SQL databases to read and write data.
Connection​
To establish a connection with the MS SQL Server data source, click on the + Add new Data source button located on the query panel or navigate to the Data Sources page from the ToolJet dashboard.
Please make sure the Host/IP of the database is accessible from your VPC if you have self-hosted ToolJet. If you are using ToolJet cloud, please whitelist our IP.
ToolJet requires the following to connect to your PostgreSQL database.
- Host
- Port
- Username
- Password
- Connection Options
- Azure (Select this option if you are using Azure SQL databases)
Note: It is recommended to create a new database user so that you can control the access levels of ToolJet.

Connection Options​
You can add optional configurations in key-value pairs for the MS SQL data source connection.
Example:​
Key | Value |
---|---|
trustServerCertificate | true |
These options allow you to fine-tune the connection, such as enabling encryption when using a self-signed certificate.
Enabling Encryption with a Self-Signed Certificate​
To enhance security during data transfer, encryption can be enabled even with a self-signed certificate.
Server-Side Configuration​
- Create and Install a Self-Signed Certificate:
- Generate a self-signed certificate and install it on the SQL Server instance.
- Force Encryption:
- Configure the SQL Server instance to force encrypted connections.
- For Azure SQL databases, turn on the Encryption toggle in the Azure portal.
Client-Side Configuration​
- Set the connection option
trustServerCertificate
totrue
.- This bypasses certificate chain validation and is necessary when using a self-signed certificate.
Querying in SQL Mode​
SQL mode can be used to query MS SQL Server / Azure SQL Databases using SQL queries.
- Create a new query and select the MS SQL data source.
- Select SQL mode from the dropdown.
- Enter the SQL query in the editor.
- Click on the Run button to run the query.
Example​
SELECT * FROM users

Parameterized Queries​
ToolJet offers support for parameterized SQL queries, which enhance security by preventing SQL injection and allow for dynamic query construction. To implement parameterized queries:
- Use
:parameter_name
as placeholders in your SQL query where you want to insert parameters. - In the Parameters section below the query editor, add key-value pairs for each parameter.
- The keys should match the parameter names used in the query (without the colon).
- The values can be static values or dynamic values using the
{{ }}
notation.

Example:​
Query: SELECT * FROM users WHERE username = :username
SQL Parameters:
- Key: username
- Value: oliver // or
{{ components.username.value }}
Query Timeout​
You can set the timeout duration for SQL queries by adding the PLUGINS_SQL_DB_STATEMENT_TIMEOUT
variable to the environment configuration file. By default, it is set to 120,000 ms.
Querying in GUI Mode​
GUI mode can be used to query MS SQL Server / Azure SQL Databases without writing queries.
- Create a new query and select the MS SQL data source.
- Select GUI mode from the dropdown.
- Choose the operation Bulk update using the primary key.
- Enter the Table name and Primary key column name.
- In the editor, enter the records in the form of an array of objects.
- Click on the Run button to run the query.
Example​
{{ [ {id: 1, channel: 33}, {id: 2, channel: 24} ] }}

Query results can be transformed using transformations. Read our transformations documentation to see how: link