title: Does T-SQL allow multiple ELSE IF? Or must I nest conditionals? SQL Server 2012
body: <p>In C#, you can have multiple conditionals of which only one will execute:</p>
  
  <pre><code>if (Condition1)
  {
      // Condition1 is true.
  }
  else if (Condition2)
  {
      // Condition1 is false and Condition2 is true.
  }
  else if (Condition3)
  {
      // Condition1 is false and Condition2 is false and Condition3 is true.
  }
  else
  {
      // Condition1, Condition2, and Condition3 are false.
  }
  </code></pre>
  
  <p>But does the same logic work in T-SQL or must you nest the statements?  Will this execute exactly like the above code?</p>
  
  <pre><code>IF @variable1 = 1
      BEGIN
          --@variable1 = 1
      END
  ELSE IF @variable1 = 2
      BEGIN
          --@variable1 = 2
      END
  ELSE IF @variable3 = 3
      BEGIN
          --@variable1 = 3
      END
  ELSE
      BEGIN
          --@variable1 &gt; 3
      END
  </code></pre>
  
  <p>I might be wrong here, but isn't there a way the SQL code would not evaluate the same way as the C# code from a logic standpoint if SQL doesn't allow multiple conditionals like C#?  For example, is execution of each new ELSE IF guaranteed to be exclusive of the previous statements?</p>