title: Why can't I use "create schema" in a begin/end block in SQL Management Studio?
body: <p>I generated a script which creates all users and schemas for this database and when I wrap the CREATE statements with an IF EXISTS check I find that it does not allow the CREATE SCHEMA call to run in the BEGIN/END block. It complains that it is invalid syntax. Yet I can run the command on it's own. A sample of the code is below. I am using SQL Server 2008 and Management Studio R2. Why is this invalid syntax?</p>
  
  <pre><code>--DROP SCHEMA [acme]
  
  IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'acme')) 
  BEGIN
      CREATE SCHEMA [acme] AUTHORIZATION [dbo]
  END
  </code></pre>