title: "Incorrect syntax near 'GO'" when inserting values
body: <p>I'm getting the error above.
  I use this code:</p>
  
  <pre><code>  //split the script on "GO" commands
                  string[] splitter = new string[] { "\r\nGO\r\n" };
                  string[] commandTexts = data.Split(splitter,
                    StringSplitOptions.RemoveEmptyEntries);
  
    foreach (string commandText in commandTexts)
    {
      SqlCommand cmdScript = new SqlCommand(commandText, conn);
      cmdScript.ExecuteNonQuery();               
     }
  </code></pre>
  
  <p>I scripted the content of my tables with the SSMS so I got a file with lots of 'INSERT INTO' Statements and some 'GO' Statements between them. </p>
  
  <p>The last 'GO' statement isn't at the end of the file - after the last statement there are a few 'INSERT INTO' lines. This works fine when executing it in SSMS but not in C# with the construct above.</p>
  
  <p>I put a counter in to count the amount of 'commandText' int the loop. I had 3107. After I added a 'GO' at the end of the file, my counter shows 3108 and still get the error. In both cases all data gets completely inserted into my tables, so the error happens at the end.
  Any idead what this could be?</p>