BEGIN...END block in SQL Server
<p>Are there any rules defined for grouping the T-SQL statements under the <code>BEGIN...END</code> block ?</p>

<p>Because when I try the <code>BEGIN...END</code> block inside the <code>CASE</code> statement OR <code>IIF</code> statement, it fails. </p>

<p>I need <code>BEGIN...END</code> block because there are multiple operations that I want to perform under the <code>CASE</code> result.</p>

<pre><code>SELECT 
CASE @ChargePaid
WHEN 1 THEN 
            BEGIN 
             SELECT 'Paid'
            END
WHEN 0 THEN 
            BEGIN 
             SELECT 'Not Paid'
            END
END
</code></pre>

<p>OR</p>

<pre><code>SELECT IIF( @ChargePaid &gt; 0, BEGIN SELECT 'Paid' END , BEGIN SELECT 'Not Paid' END )
</code></pre>

<p><strong>EDIT:</strong></p>

<pre><code>IF @cond = 'First'
WITH CTE AS (
             SELECT 'A missing' Result
             UNION 
             SELECT 'B missing' Result
             UNION 
             SELECT 'C missing' Result
)
SET @msg = SELECT Result from CTE 

IF @cond = 'Second'
WITH CTE AS (
              SELECT 'A missing' Result
              UNION 
              SELECT 'B missing' Result
              UNION 
              SELECT 'C missing' Result
)
SET @msg = SELECT Result from CTE 

IF @ChargePaid = 0
...
Some code goes here to generate the message.
Then I store the actual message into @msg variable.
...

In the end I store the @msg values (I trim the @msg if it requires) to the table. 
</code></pre>

<p>What I want is:</p>

<p>I want to validate the @ChargePaid condition. 
If it comes false, I want to avoid further processing for optimization of code &amp; store charge missing info to @msg variable\table.</p>