mssql_execute_sql
Run arbitrary T-SQL statements against SQL Server, including parameterized queries, batch separators, and optional transaction control.
Instructions
Execute arbitrary T-SQL - sql="ANY_VALID_TSQL" with optional parameters, GO batch separators and transaction support. Examples: sql="CREATE INDEX ...", sql="WITH cte AS (...) SELECT ...", transactional=true
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | T-SQL to execute (any valid SQL Server SQL; GO separators split batches) | |
| timeout | No | Query timeout in milliseconds (per batch) | |
| expectRows | No | Whether to expect rows back (false for statements like CREATE, DROP, etc.) | |
| parameters | No | Parameter values for @p1, @p2, ... (or $1, $2, ...) placeholders | |
| transactional | No | Whether to wrap all batches in a single transaction | |
| connectionString | No | SQL Server connection string (optional; requires --allow-tool-connection-string) |