New260+ blocks and 240+ tools are now fully documented
DocumentationReferenceCore BlocksDatabases
Block

Microsoft MSSQL Block

Execute SQL queries and manage files in Microsoft SQL Server

The Microsoft MSSQL block connects to a Microsoft SQL Server instance to execute T-SQL queries, manage data (insert/update/delete), and perform file operations. Use it when a workflow needs to read from or write to a SQL Server database with secure connections, automatic query parameterization, and connection pooling.

Overview

PropertyValue
Typemssql
Categorytools
Color#CC2927

When to Use

  • Run ad-hoc T-SQL SELECT queries against a SQL Server database and pipe results into downstream blocks.
  • Insert new records into a table from data produced earlier in the workflow (single row or batch).
  • Update existing rows using JSON-defined field values and WHERE conditions.
  • Delete rows that match specific conditions without writing raw SQL.
  • Create, read, edit, delete, or list files associated with the SQL Server host (e.g., scripts, config files).
  • Connect to on-premises or cloud SQL Server over SSL/TLS, including environments that use self-signed certificates.

Configuration

Server

Required. The SQL Server hostname or IP address (e.g. localhost or server.domain.com). Accepts {{...}} references.

Port

SQL Server port. Defaults to 1433. Override only when the instance listens on a non-standard port.

Database

Required. The target database name (e.g. MyDatabase).

Username

Required. The SQL Server login name (e.g. sa or domain\user).

Password

Required. The database password. Store secrets as environment variables and reference them with {{ENV_VAR_NAME}} (e.g. {{MSSQL_PASSWORD}}).

Enable SSL Encryption

Toggle (switch). Enables SSL/TLS encryption for the connection. Defaults to true in the underlying tool.

Trust Server Certificate

Toggle (switch). When enabled, the driver accepts self-signed certificates without validation. Defaults to false.

Action

Required. Dropdown that selects the operation to perform. Defaults to execute. Options:

LabelIDRequired additional fields
Execute Queryexecutequery
Insert Datainserttable, data
Update Dataupdatetable, data, conditions
Delete Datadeletetable, conditions
Create Filecreate_filefilePath, content
Get Fileget_filefilePath
Edit Fileedit_filefilePath, content
Delete Filedelete_filefilePath
List Fileslist_filesfolderPath (optional)

SQL Query

Visible when action = execute. The T-SQL statement to run (e.g. SELECT * FROM Users WHERE active = 1). Supports AI-assisted generation via the wand icon. Reference prior block outputs with {{blockName.output.fieldName}} and workflow variables with {{variable.variableName}}.

Table Name

Visible when action is insert, update, or delete. Required for those actions. The name of the target table (e.g. Users, Products).

Data

Visible when action is insert or update. Required for those actions. A JSON object (or array of objects) containing the field values to write. Example: {"name": "John Doe", "email": "john@example.com", "active": true}. Supports AI-assisted generation.

Conditions (WHERE clause)

Visible when action is update or delete. Required for those actions. A JSON object defining the WHERE conditions (e.g. {"id": 123} or {"status": "active"}).

File Path

Visible when action is create_file, get_file, edit_file, or delete_file. Required for those actions. Path to the target file (e.g. scripts/backup.sql).

File Content

Visible when action is create_file or edit_file. Required for those actions. The content to write into the file.

Folder Path

Visible when action = list_files. Optional. The folder to list files from (e.g. scripts/). Leave empty to list from the root.

Inputs & Outputs

Inputs:

  • server (string) — SQL Server hostname or IP
  • port (number) — SQL Server port
  • database (string) — Database name
  • username (string) — Database username
  • password (string) — Database password
  • encrypt (boolean) — Enable SSL encryption
  • trustServerCertificate (boolean) — Trust server certificate
  • action (string) — Operation to perform
  • query (string) — SQL query to execute
  • table (string) — Table name for operations
  • data (json) — Data for insert/update operations
  • conditions (json) — WHERE conditions for update/delete
  • filePath (string) — File path for file operations
  • content (string) — File content
  • folderPath (string) — Folder path for listing files

Outputs:

  • data (json) — Query results for SELECT operations
  • affectedRows (number) — Number of rows affected by INSERT/UPDATE/DELETE operations
  • metadata (json) — Query execution metadata including timing and row counts
  • fileName (string) — Name of the file for file operations
  • filePath (string) — Full path of the file
  • content (string) — File content for get/edit operations
  • files (json) — List of files and folders for list operations
  • error (string) — Error message if operation fails
  • errorDetails (json) — Detailed error information including type and execution time

Tools

Microsoft SQL Server (mssql_database) — Executes SQL queries and manages files in a Microsoft SQL Server database. Dispatches to the /api/tools/mssql endpoint using connection parameters, the selected action, and any action-specific inputs. Handles all nine operations: execute, insert, update, delete, create_file, get_file, edit_file, delete_file, and list_files. Uses connection pooling (up to 10 connections per host) with parameterized queries to prevent SQL injection.

YAML Example

mssql_1:
  type: mssql
  name: "Microsoft MSSQL"
  inputs:
    server: "localhost"
    port: 1433
    database: "MyDatabase"
    username: "sa"
    password: "{{MSSQL_PASSWORD}}"
    encrypt: true
    trustServerCertificate: false
    action: "execute"
    query: "SELECT * FROM Users WHERE active = 1"
  connections:
    outgoing:
      - target: next-block-id