Write Advanced SQL Stored Procedures
Generate production-ready SQL stored procedures with error handling, optimization, and documentation. Perfect for database developers.
Prompt Template
Variables to Customize
[DATABASE_SYSTEM] The database management system (SQL Server, PostgreSQL, MySQL, Oracle, etc.)
Example: SQL Server
[PROCEDURE_NAME] The name for the stored procedure
Example: sp_ProcessCustomerOrder
[BUSINESS_LOGIC] Detailed description of what the procedure should accomplish
Example: Process a customer order by validating inventory, calculating totals with tax and shipping, updating stock levels, and creating order records
[INPUT_PARAMETERS] List of input parameters with their data types
Example: @CustomerID INT, @ProductIDs VARCHAR(MAX), @Quantities VARCHAR(MAX), @ShippingAddress NVARCHAR(500)
[EXPECTED_OUTPUT] What the procedure should return or output
Example: Return OrderID if successful, or error code with message if failed. Also return order total and estimated delivery date.
Example Output
Pro Tips for Best Results
- Always specify the exact database system as syntax varies significantly between platforms
- Include realistic business scenarios in your requirements to get more practical error handling
- Request both positive and negative test cases to ensure comprehensive validation
- Ask for performance considerations if the procedure will handle large datasets
- Specify security requirements upfront, especially for procedures that modify sensitive data
Tags
Want 500+ Expert Prompts?
Get the Premium Prompt Pack — organized, tested, and ready to use.
Get it for $29Related Prompts You Might Like
Optimize SQL Query Performance
You are a senior database performance engineer specializing in SQL query optimization. I need you to analyze and optimiz...
Analyze Survey Response Data
You are an expert data analyst specializing in survey research. I need you to analyze the following survey response data...
Perform A/B Test Analysis
You are a data analyst specializing in A/B test analysis. I need you to analyze the results of an A/B test and provide c...
Analyze Time Series Data with Statistical Insights
You are an expert data scientist specializing in time series analysis. Please perform a comprehensive analysis of the pr...
Create Real-Time Sales Dashboard
You are a senior business intelligence analyst and dashboard architect. Create a comprehensive real-time sales dashboard...
Clean Messy CSV Data
You are a data cleaning specialist. I need help cleaning a messy CSV dataset. Please analyze the data and provide a comp...