title: SQL Server - Using GO for multiple statements in prepared statement
body: <p>I have been trying to execute a prepared statement using SQL Server that has 2 sql statements, one to create table, and one to update the default value for the <code>created</code> column.</p>
  <p>I've basically copied the create code from MSSMS and stringified it.</p>
  <p>This is my SQL (<code>@name</code> is the database name to be created)</p>
  <pre><code>declare @q varchar(max);
  set @q=CONCAT('CREATE TABLE ',@name,' (',
  '[id] [bigint] IDENTITY(1,1) NOT NULL,',
  '[created] [datetime] NULL,',
  'CONSTRAINT [PK_',@name,'] PRIMARY KEY CLUSTERED',
  '(',
  '[id] ASC',
  ')WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]',
  ') ON [PRIMARY];',
  'GO;',
  'ALTER TABLE ',@name,' ADD  CONSTRAINT [DF_',@name,'_created]  DEFAULT (getdate()) FOR [created];',
  'GO;');
  exec(@q);
  </code></pre>
  <p>It's telling me I have incorrect syntax around the <code>GO</code> statements, despite have statement break semi-colons.</p>
  <p>Is having 2 statements inside a prepared statement even possible in this context?</p>
  <p>Should I wrap them in some other fashion?</p>
  <p><em>BTW: Put <code>GO</code> in any google search and you get a thousand results for some GoSQL language I never heard of.</em></p>