title: DECLARE CURSOR must be the only statement in a query batch
body: <p>I have this below script that is getting "DECLARE CURSOR must be the only statement in a query batch". May I ask what's wrong this this? </p>
  
  <p>This script is saved in a file and is being executed from isql client. </p>
  
  <pre><code>DECLARE c1 cursor FOR
  select sql_query from tempdb..M3_Checks_Query
  GO
  
  DECLARE @sql_query text
  
  OPEN c1
  FETCH c1 into @sql_query --@check_id , @sql_query, @base_table, @run_flag
  
  WHILE @@sqlstatus = 0
  BEGIN
  print "test"
  FETCH c1 into @sql_query
  END
  
  CLOSE c1
  DEALLOCATE c1
  </code></pre>