build_procedure
Generate a CREATE OR ALTER PROCEDURE script from a query, converting inline SQL or library queries into a stored procedure with typed parameters. Returns SQL, undo script, and an EXEC example.
Instructions
Generate a CREATE OR ALTER PROCEDURE script (TEXT ONLY -- never executed here) around a query. Give inline 'sql', or a library 'query' -- then its header params (name, type, default) become the procedure's parameters automatically. Every @variable in the body must be a typed parameter. params: [{"name": "@StartDate", "type": "date", "default": "'2026-01-01'", "description": "first order date"}] Returns sql + undo_sql + notes (including an EXEC example).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | ||
| name | Yes | ||
| query | No | ||
| params | No | ||
| description | No |