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.
CreateTable is a typed wrapper for CREATE TABLE operations. Unlike the generic ExecuteSQL tool, it sets ReadOnly=false, Destructive=false in MCP metadata, clearly distinguishing a schema-creation action from destructive mutations. MCP-aware clients can use this distinction to apply lighter confirmation logic for table creation than they would for drops or bulk deletes.
Parameter
A complete
CREATE TABLE T-SQL statement. Schema-qualified table names (e.g. dbo.MyTable) are strongly recommended to avoid ambiguity. The statement is passed directly to SqlCommand.ExecuteNonQueryAsync — no transformation is applied.Return value
CreateTable returns a DbOperationResult object:
rowsAffected is not populated for DDL statements. Use DescribeTable after a successful create to verify the column list, constraints, and indexes were applied as intended.AI Insights integration
On success,CreateTable calls QueueInsightDdlProcessing() to enqueue a background DDL audit drain and schema-fingerprint reconciliation — the same pipeline triggered by ExecuteSQL. This is automatic when USE_INSIGHTS_LAYER is enabled (the default). The new table will be eligible for baseline insight generation on the next reconciliation pass if INSIGHTS_AUTOPOPULATE is also enabled.
Example
Basic CREATE TABLE
CREATE TABLE with a foreign key
CREATE TABLE IF NOT EXISTS pattern
SQL Server does not have a nativeCREATE TABLE IF NOT EXISTS syntax. Use a conditional check before calling CreateTable: