The topic describes the DF111 T-SQL code analysis rule.
STYLE
Code contains too many nested IF, WHILE, or TRY statements (Nesting level > 4).
For better readability and performance, it’s recommended to avoid excessive nesting of control flow statements such as IF, WHILE, and TRY.
Excessive nesting of control flow statements such as IF, WHILE, or TRY can make the code harder to read, understand, and maintain. It increases complexity and reduces readability, as developers need to mentally track multiple levels of nested logic. Moreover, deeply nested code can be error-prone and difficult to debug.