title: Can't create schema inside begin block
body: <p>I'm completely stumped. I have the following block:</p>
  
  <pre><code>IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name = 'Test')
  BEGIN
      CREATE SCHEMA Test;
  END;
  </code></pre>
  
  <p>If I run this against our SQL Server 2008, I get "Msg 156, Level 15, State 1, Line 3: Incorrect syntax near the keyword 'SCHEMA'" but if I run just the <code>CREATE SCHEMA</code> command alone, it works.</p>
  
  <p>Also, this works:</p>
  
  <pre><code>IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name = 'Test')
  BEGIN
      PRINT 'CREATE GOES HERE';
  END;
  </code></pre>
  
  <p>What am I doing wrong?</p>