title: syntax error near go in a script run from powershell
body: <p>I'm trying to bulk import into SQL Server, and I need to automate the task (there are thousands of directories) in Powershell. I'm using bcp and have a format file because I need to skip a column when importing. Whenever I run this, it fails with the error:</p>
  
  <blockquote>
    <p>Exception calling "ExecuteReader" with "0" argument(s): "Incorrect syntax near 'GO'.  </p>
  </blockquote>
  
  <p>The code is: </p>
  
  <pre><code>$query =
  "USE Database;  
   GO  
   BULK INSERT $tableName   
      FROM 'C:\users\Name\documents\bcp_sql\File\$name\$dir_id${string}.csv'   
      WITH (FORMATFILE = 'C:\users\Name\documents\bcp_sql\formatFile.fmt');  
      GO  
      SELECT * FROM $tableName;  
      GO"  
  $sqlCmd2 = $connection.CreateCommand()
  $sqlCmd2.Connection = $connection
  $sqlCmd2.CommandText = $query
  $sqlCmd2.ExecuteReader()
  </code></pre>
  
  <p>I've confirmed that the file paths do, in fact, exist (by cd-ing to them). </p>