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
SRD0066.md•1.11 KiB
# SQL Server Rule: SRD0066
| | |
|----|----|
| Assembly | SqlServer.Rules |
| Namespace | SqlServer.Rules.Design |
| Class | UseBeginEndRule |
## Rule Information
| | |
|----|----|
| Id | SRD0066 |
| Friendly Name | BEGIN and END symbols inside conditional statements. |
| Category | Design |
| Ignorable | true |
| Applicable Types | Procedure |
| | Scalar Function |
| | Table Valued Function |
| | View |
## Description
Use BEGIN and END symbols inside conditional statements.
## Summary
Use BEGIN and END symbols inside conditional statements.
### Examples
Examples of **incorrect** code for this rule:
```tsql
IF(@parm = 1)
SELECT @output = 'foo'
```
Examples of **correct** code for this rule:
```tsql
IF (@parm = 1)
BEGIN
SELECT @output = 'foo'
END
```
```sql
CREATE PROCEDURE dbo.BeginEnd
@parm INT
AS
SET NOCOUNT ON;
IF(@parm = 1)
SELECT 'foo';
ELSE
SELECT 'fix';
IF (@parm = 2)
BEGIN
SELECT 'bar';
END;
-- SRD0066
```
### Remarks
Use BEGIN and END to bind conditional statments as a single block of code.
<sub><sup>Generated by a tool</sup></sub>