QANode Logo

SQL Server Node

The SQL Server node runs queries and operations against Microsoft SQL Server databases. It provides a visual query builder for common operations and also supports Custom SQL when you need full control.


Overview

PropertyValue
Typesqlserver-query
CategoryDatabase
Color🟢 Green (#22c55e)
Inputin
Outputout

Connection

Using Saved Credentials (Recommended)

Select a SQL Server credential in the Credential field. The credential centralizes connection data and avoids exposing the password directly in the node.

Manual Configuration

FieldTypeDescription
HoststringSQL Server address
PortnumberTCP port (default: 1433)
DatabasestringDatabase name
UserstringConnection user
PasswordstringConnection password
EncryptbooleanUses encrypted connection
Trust Server CertificatebooleanAccepts the server certificate without full validation

In corporate environments, Encrypt is often required. In internal environments with self-signed or private certificates, Trust Server Certificate may be necessary.


Query Modes

SQL Server supports the same visual presets as the other relational database nodes:

  • Custom SQL — free SQL with {{ }} expressions;
  • SELECT — visual query builder;
  • EXISTS — checks whether a record exists;
  • COUNT — counts records;
  • ASSERT — validates a value in the database;
  • INSERT — inserts records;
  • UPDATE — updates records;
  • DELETE — deletes records.

The query builder automatically generates SQL compatible with SQL Server.


Custom SQL

Use Custom SQL when you need to write the query manually.

FieldTypeDescription
SQLstringSQL query, with support for {{ }} expressions

Using Expressions in SQL

In the current SQL Server node panel, a custom query is written directly in the SQL field. To use dynamic values, write {{ }} expressions inside the SQL itself.

Complete example:

SELECT *
FROM dbo.Users
WHERE email = '{{ variables.TEST_EMAIL }}'
  AND active = 1;

If variables.TEST_EMAIL is john@example.com, the executed SQL is equivalent to:

SELECT *
FROM dbo.Users
WHERE email = 'john@example.com'
  AND active = 1;

For values from previous steps, use the same syntax:

SELECT *
FROM dbo.Users
WHERE id = {{ steps.api.outputs.json.id }};

For text, dates, and values that SQL should treat as strings, add quotes:

SELECT *
FROM dbo.Orders
WHERE customer_email = '{{ steps.api.outputs.json.email }}'
  AND created_at >= '{{ variables.START_DATE }}';

For numbers and flags, usually do not add quotes:

SELECT *
FROM dbo.Users
WHERE id = {{ variables.USER_ID }}
  AND active = {{ variables.ACTIVE_FLAG }};

Careful: because expressions are applied directly inside SQL, use controlled values and review quotes for text fields. Avoid injecting free-form end-user input without validation.


Visual SELECT

In the SELECT preset, you can build queries without writing SQL manually.

FieldDescription
TableSource table
ColumnsReturned columns; empty returns all columns
WhereFilter conditions
Order BySorting
LimitMaximum number of records

In SQL Server, the limit is generated as TOP (...), not as LIMIT.

Generated example:

SELECT TOP (10) [id], [email], [active]
FROM [dbo].[Users]
WHERE [active] = 1;

SQL Server Differences

TopicBehavior
Default port1433
Row limitTOP (...)
IdentifiersColumns and tables may be generated with brackets, such as [Users]
BooleansMany SQL Server databases use 1 and 0 in bit columns
TLS/certificateMay require Encrypt and Trust Server Certificate, depending on the environment

Outputs

OutputTypeDescription
rowsarrayRecords returned by the query
rowCountnumberNumber of rows returned in the first recordset
recordsAffectedarrayRows affected by write commands, when reported by the driver

Accessing Outputs

{{ steps["sqlserver-query"].outputs.rows }}
{{ steps["sqlserver-query"].outputs.rows[0].email }}
{{ steps["sqlserver-query"].outputs.rowCount }}
{{ steps["sqlserver-query"].outputs.recordsAffected }}

Examples

Validate a Record Created by API

[HTTP Request: POST /users]
    │
    â–¼
[SQL Server: SELECT * FROM dbo.Users WHERE email = '{{ steps["http-request"].outputs.json.email }}']
    │
    â–¼
[If: {{ steps["sqlserver-query"].outputs.rowCount > 0 }}]

Prepare Test Data

INSERT INTO dbo.TestData ([key], [value])
VALUES ('test_order', '{{ variables.ORDER_ID }}');

Clean Up Test Data

DELETE FROM dbo.TestData
WHERE [key] = 'test_order';

Tips

  • Use saved credentials whenever possible.
  • Test the connection before running the scenario.
  • Add quotes around expressions that represent text or dates.
  • In environments with internal certificates, review Encrypt and Trust Server Certificate.
  • For simple queries, prefer the visual query builder; for joins, procedures, or advanced SQL, use Custom SQL.