DF032: A control-of-flow statement is not defined by using a statement block.
Last modified: May 28, 2025
The topic describes the DF032 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
A control-of-flow statement is not defined by using a statement block.
Description
It is recommended to use the BEGIN…END keywords to enclose control-of-flow statements into a statement block.
Additional information
The nested IF-ELSE clause doesn’t need to be enclosed by the BEGIN and END keywords. However, the IF clause must be wrapped by the BEGIN and END keywords.
Noncompliant code example
IF @Var1=1 SELECT '1' AS Result ELSE SELECT '2' AS Result
Compliant solution
IF @Var1=1 BEGIN
SELECT '1' AS Result
END ELSE BEGIN
SELECT '2' AS Result
END
Was this page helpful?
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.