We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ErikEJ/SqlServer.Rules'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
SRD0063.md•854 B
# SQL Server Rule: SRD0063
| | |
|----|----|
| Assembly | SqlServer.Rules |
| Namespace | SqlServer.Rules.Design |
| Class | AvoidIfInStoredProcRule |
## Rule Information
| | |
|----|----|
| Id | SRD0063 |
| Friendly Name | Avoid wrapping SQL in IF statement |
| Category | Design |
| Ignorable | true |
| Applicable Types | Procedure |
## Description
Do not use IF statements containing queries in stored procedures.
## Summary
Avoid wrapping SQL statements in stored procedures with IF statements. Consider extracting the nested SQL statements to their own stored procedure.
### Examples
```sql
CREATE PROCEDURE dbo.TestWithExists
AS
Set nocount on
IF EXISTS(SELECT * FROM dbo.TestTableSSDT) BEGIN
SELECT Idcol from dbo.TestTableSSDT
end
-- SML005, SRD0063
```
<sub><sup>Generated by a tool</sup></sub>