Skip to main content

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.

DropTable is a typed wrapper for DROP TABLE operations. It is marked ReadOnly=false, Destructive=true in MCP metadata — MCP-aware clients must surface a confirmation prompt to the user before executing this tool. Unlike CreateTable and InsertData, DropTable shares its destructive classification with ExecuteSQL and UpdateData.
This operation is irreversible. Once a table is dropped, its schema and all row data are permanently deleted and cannot be recovered except from a backup. Always confirm the exact table name and scope with the user before calling DropTable.

Parameter

sql
string
required
A complete DROP TABLE T-SQL statement. Schema-qualified names (e.g. dbo.MyTable) are required to avoid ambiguity. Use the IF EXISTS guard when the table may or may not exist to prevent a SQL error.

Return value

DropTable returns a DbOperationResult object:
{
  "success": true,
  "error": null
}
On failure:
{
  "success": false,
  "error": "Cannot drop the table 'dbo.Orders', because it does not exist or you do not have permission."
}

AI Insights integration

On success, DropTable calls QueueInsightDdlProcessing() to enqueue background DDL audit processing. The database-level DDL_Audit trigger captures the DROP TABLE event in dbo.DDL_AuditLog. On the next reconciliation pass, the background service detects the fingerprint drift, archives the table’s cached SchemaInsights row to AIInsights.InsightHistory, and marks it with insightFreshness: StaleArchived. If INSIGHTS_AUTOPOPULATE is enabled and the table is later recreated with the same name, a fresh baseline insight will be generated automatically on the next introspection call.

Examples

DROP TABLE IF EXISTS dbo.Orders;

DROP TABLE without IF EXISTS guard

DROP TABLE dbo.Orders;
Without IF EXISTS, the statement raises an error if the table does not exist. Prefer the IF EXISTS variant in scripts that may run more than once.

DROP multiple tables in sequence

Each call to DropTable accepts a single statement. To drop multiple tables, call DropTable once per table — respecting foreign-key dependency order (child tables before parent tables).
-- First call: drop the child table
DROP TABLE IF EXISTS dbo.OrderLines;
-- Second call: drop the parent table
DROP TABLE IF EXISTS dbo.Orders;
Use DescribeTable before calling DropTable to inspect foreign-key constraints and identify dependent tables that must be dropped first.

Build docs developers (and LLMs) love