query
Run a SQL query against a SQL Server instance using a named connection, with configurable output format and row limits.
Instructions
Execute a SQL query on the database
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL query to execute | |
| format | No | Output format (default json). csv is far more compact for wide or long results: the first line is a JSON header with metadata, then the rows as CSV. | |
| maxRows | No | Maximum rows to return across all result sets (default 1000, max 10000). When the cap is hit the query is cancelled on the server and the response starts with truncated: true. A truncated result is incomplete and the total row count is unknown: never report the cap as the number of rows. Prefer TOP, WHERE or aggregates over raising this. | |
| connection | Yes | Connection name to use |