SQL Server Query¶
Runs a Microsoft SQL Server SELECT query using configured credentials. It loads the connection details from a credentials file and executes the SQL text, returning both a human-readable summary and machine-readable data.

Usage¶
Use this node to read data from a SQL Server database as part of a data retrieval or analytics workflow. Provide a valid credentials file for the target SQL Server instance and a SELECT statement. Chain the outputs to downstream nodes that need tabular data or JSON for further processing.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| credentials_path | True | STRING | Path to the stored SQL Server credentials file that contains host, port, database, username, and password. | /workspace/secrets/mssql.json |
| timeout | False | INT | Maximum time in seconds to wait for the query to complete before failing. | 60 |
| sql_text | True | STRING | The SQL SELECT statement to execute against SQL Server. Multiline input supported. | SELECT TOP 10 id, name, email FROM dbo.users ORDER BY created_at DESC |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| text | STRING | A readable summary of the query results, suitable for logs or quick inspection. | SQL Server Query Results: 10 rows returned from dbo.users |
| json | JSON | The raw query result data as JSON for programmatic use downstream. | [{"id": 1, "name": "Alice", "email": "alice@example.com"}] |
Important Notes¶
- Read-only focus: This node is intended for SELECT queries. Use SaltMSSQLExecute for INSERT/UPDATE/DELETE.
- Credentials required: The credentials file must be valid and have permissions to run the provided query.
- Timeouts: Long-running queries may exceed the timeout and fail; adjust the timeout or optimize the query.
- Result size: Very large result sets can be slow and memory intensive; consider limiting rows with TOP or filters.
- Security: Avoid untrusted dynamic input in SQL to prevent SQL injection.
Troubleshooting¶
- Authentication failed: Verify credentials_path points to a valid file and that username/password and database are correct.
- Connection timeout: Increase the timeout input or ensure the SQL Server host, port, and network access are correct.
- Syntax error in SQL: Validate the sql_text against SQL Server syntax (e.g., use TOP for limits).
- Empty or unexpected results: Confirm table/schema names (e.g., dbo.users) and add appropriate WHERE filters.
- Insufficient permissions: Ensure the database user has SELECT privileges on the referenced tables or views.