Skip to content

SQL Server Execute

Executes non-SELECT SQL statements (INSERT, UPDATE, DELETE, DDL) against a Microsoft SQL Server database. Uses a connection URI to contact the Salt database service and returns a concise execution summary and a JSON result. Designed for write/administrative operations rather than data retrieval.
Preview

Usage

Use this node when you need to modify data or schema in a SQL Server database from a Salt workflow. Provide a valid MSSQL connection URI and a single SQL statement to execute. For read operations (SELECT), use the SQL Server Query node instead. Typical usage: build or provide a connection string, set a reasonable timeout, enter your SQL statement, and connect the outputs to logging or downstream control nodes.

Inputs

FieldRequiredTypeDescriptionExample
credentials_pathTrueSTRINGDatabase connection URI in MSSQL format. Must include protocol, host, port, database, and authentication details. Example schemes: mssql:// or sqlserver://mssql://sa:@db.example.com:1433/mydatabase
timeoutTrueINTRequest timeout in seconds for the execution call to the database service.60
sql_textTrueSTRINGThe SQL statement to execute. Intended for non-SELECT operations such as INSERT, UPDATE, DELETE, or DDL.INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com')

Outputs

FieldTypeDescriptionExample
resultSTRINGHuman-readable summary of the execution outcome (e.g., affected rows).Statement executed successfully. Affected rows: 1
json_resultSTRINGRaw JSON response from the database service with structured execution details.{"affected_rows": 1, "status": "success"}
html_tableSTRINGHTML table representation of results. For execute operations this is typically empty.
xlsx_dataSTRINGBase64-encoded XLSX data of results. For execute operations this is typically empty.
pdf_dataSTRINGBase64-encoded PDF data of results. For execute operations this is typically empty.

Important Notes

  • Ensure the credentials_path is a valid MSSQL URI (e.g., mssql://user:pass@host:1433/database). Invalid or unsupported schemes will be rejected.
  • This node is for non-SELECT statements. Use SQL Server Query for data retrieval to get tabular outputs.
  • A properly configured service endpoint for SQL Server must be available; if not set globally, provide service_url via the connection URI query parameters.
  • Execution is sent to a remote service; network connectivity and service availability are required.
  • Be cautious with dynamic SQL to avoid SQL injection. Provide parameterized or trusted statements when possible.
  • The html_table, xlsx_data, and pdf_data outputs are not populated for execute operations and will usually be empty strings.

Troubleshooting

  • Invalid credentials URI: Verify the URI starts with mssql:// or sqlserver:// and includes host, port, and database.
  • Connection or timeout errors: Increase the timeout value and ensure the database service endpoint is reachable from your environment.
  • Authentication failures: Check username/password, firewall rules, and that the target instance accepts your auth method.
  • SQL syntax errors: Validate sql_text by running it directly against the database or testing in a SQL client.
  • Insufficient privileges: Ensure the provided user has rights to execute the given statement.
  • Service URL not configured: If the workflow environment lacks a configured MSSQL data connector endpoint, include service_url in the connection URI query parameters or update global endpoints.