title: How do I fix "incorrect syntax near GO" errors in scripts generated with Microsoft's Database Publishing Wizard?
body: <p>I've been searching for a "definitive" solution to this for a couple of hours now and can't find out exactly what the problem is so am hoping someone can point me in the right direction.</p>
  
  <p>I'm trying to create a script for a database (an MDF file DB) on a remote machine and use it to create the same database locally. I've got Visual Studio 2010 on both machines so used the Database Publishing Wizard to generate the script.</p>
  
  <p>I next created a blank DB in Visual Studio locally (another MDF file DB) and selected to create a new query. I've pasted the copied script in but when I try and run it I get dozens of "incorrect syntax near GO" errors. I'm not sure how many in total as the alert pop-up goes off the bottom of my screen. It would seem to be a lot though.</p>
  
  <p>I trimmed off all but the very top of the script and I still get the same errors with it. It now looks like this:</p>
  
  <pre><code>SET ANSI_NULLS ON
  
  GO
  </code></pre>
  
  <p>I still get the "incorrect syntax near GO" error with this.</p>
  
  <p>Is there something inherently wrong with the scripts this tool generates or am I doing something wrong with it?</p>
  
  <p>The remote DB is 2008 R2 and my local is just plain 2008, hence why I don't just copy the MDF file across.</p>
  
  <p>If anyone has any suggestions, they would be most welcome.</p>