Documentation Index
Fetch the complete documentation index at: https://mintlify.com/A-Point-Systems-ltd/ms-sql-mcp/llms.txt
Use this file to discover all available pages before exploring further.
ExecuteSQL is the write entry point for all DDL and DML operations against the connected SQL Server or Azure SQL Database. It is marked destructive in MCP metadata (ReadOnly=false, Idempotent=false, Destructive=true) — MCP-aware agents and clients should confirm intent with the user before calling it.
Parameter
A single non-SELECT T-SQL statement (DDL or DML). Multi-batch scripts separated by
GO are not supported. A trailing semicolon is allowed; a semicolon between two statements is rejected.Accepted statement types
ExecuteSQL accepts any statement whose leading keyword is one of the following:
| Category | Keywords |
|---|---|
| DML | INSERT, UPDATE, DELETE, MERGE |
| DDL | CREATE, ALTER, DROP, TRUNCATE |
| Procedural | EXEC, EXECUTE |
| Security | GRANT, REVOKE, DENY |
| Backup | BACKUP, RESTORE |
Rejected inputs
SELECT— useReadData.WITH … SELECT(read-only CTEs) — useReadData.- Multi-statement batches containing an internal semicolon (e.g.
INSERT …; UPDATE …). GObatch separators.
SqlStatementClassifier enforces this split. An unsupported leading keyword produces:
“Unsupported or unrecognized statement type ‘{keyword}’. Use ReadData for SELECT queries.”
AI Insights integration
On every successful execution, the server callsQueueInsightDdlProcessing(), which enqueues a background DDL audit drain and schema-fingerprint reconciliation via InsightDdlProcessingQueue. This happens automatically whenever USE_INSIGHTS_LAYER is enabled (the default). No extra configuration is required.
When the DDL backlog is processed, any cached SchemaInsights rows whose fingerprint no longer matches the live object are archived to AIInsights.InsightHistory. If INSIGHTS_AUTOPOPULATE is also enabled, mechanical baseline insights are rebuilt for affected objects.
Return value
ExecuteSQL returns a DbOperationResult object:
rowsAffected is populated for DML statements. For DDL statements it reflects the value returned by ExecuteNonQuery (typically –1 or 0).
Examples
CREATE TABLE
ALTER TABLE — add a column
DROP TABLE with IF EXISTS guard
DELETE with a WHERE clause
EXEC a stored procedure
Prefer the typed tools —
CreateTable, DropTable, InsertData, and UpdateData — when you need only one of those specific operations. They surface clearer MCP metadata intent and make agent audit logs easier to read.