title: Executing SQL batch containing GO statements in C#
body: <p>I am trying to build a program which execute sql statements in batch with error handling
  (therefore I am not using SMO).</p>
  
  <p>the problem is that <b>GO</b> is not a part of SQL and when using .NET to execute the statements it ends up with an error (SMO handles it but does not give any indication whether the execution failed).</p>
  
  <pre><code>string statements = File.ReadAllText("c:\\test.sql");
  string[] splitted = statements.split("GO");
  </code></pre>
  
  <p>using the above lines do not solve my problem due to the fact that the <b>GO</b> keyword can also come inside a comment (I don't want to remove comments from the statements) and comments can come inside 
      /**/
     or after the two dashes --<br>
  for example I wouldn't like the following code to be parsed:</p>
  
  <pre><code>/*
  GO
  */
  </code></pre>
  
  <p>(ofc i googled it but there was no solution over there)</p>