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.
InsertData executes a single INSERT statement against the connected SQL Server or Azure SQL Database. It is marked ReadOnly=false, Destructive=false in MCP metadata — agents can call it without a destructive-confirmation prompt, though care should still be taken to verify the target table and values before execution.
Parameter
A complete
INSERT T-SQL statement. Both INSERT … VALUES and INSERT … SELECT forms are accepted. Multi-batch scripts separated by GO are not supported. A trailing semicolon is allowed; an internal semicolon between two statements is rejected.Return value
InsertData returns a DbOperationResult with rowsAffected populated:
rowsAffected reflects the number of rows the INSERT statement inserted, as returned by ExecuteNonQueryAsync.
On failure:
AI Insights integration
On success,InsertData calls QueueInsightDdlProcessing(), which enqueues the same background DDL audit drain used by ExecuteSQL, CreateTable, DropTable, and UpdateData. This is a no-op when USE_INSIGHTS_LAYER=false.
Examples
Single-row INSERT with VALUES
Multi-row INSERT with VALUES
INSERT … SELECT from another table
INSERT with OUTPUT clause to capture generated keys
The
OUTPUT clause causes SQL Server to return a result set, but ExecuteNonQuery (used internally) still counts rows affected and discards the output rows. If you need to capture INSERTED values, consider using ReadData with an INSERT … OUTPUT … INTO @tmp; SELECT * FROM @tmp pattern wrapped in a stored procedure called via ExecuteSQL.