title: pyodbc.ProgrammingError: No results. Previous SQL was not a query, when executing multiple statements at once
body: <p>i am dealing with sql server database,</p>
  
  <p>where i have a table named '<strong>table1</strong>' containing 1 column and 1 row</p>
  
  <pre><code>exp_num
  0 
  </code></pre>
  
  <p>I am trying to update the <code>0</code> value exp_num column to +1 and also return old experiment and updated experiment.</p>
  
  <p>For this i am using declare statements.</p>
  
  <pre><code>DECLARE @UpdateOutput1 table (Oldexp_num int,Newexp_num int);
  
  UPDATE get_exp_num
      SET exp_num = exp_num+1
  
  OUTPUT
      DELETED.exp_num,
      INSERTED.exp_num
    INTO @UpdateOutput1;
  
   select * from @UpdateOutput1
  </code></pre>
  
  <p>When i'm running this in <code>SQL editor</code> i am getting the results.</p>
  
  <pre><code>Oldexp_num   Newexp_num
      0             1
  </code></pre>
  
  <p>but if i make this same as a query, and try to use pyodbc package i am getting error.</p>
  
  <pre><code>import pyodbc
  
  connection = pyodbc.connect()  # i am getting a connection
  query = "DECLARE @UpdateOutput1 table (Oldexp_num int,Newexp_num int);UPDATE get_exp_num SET exp_num = exp_num+1 OUTPUT DELETED.exp_num, INSERTED.exp_num INTO @UpdateOutput1; select Newexp_num from @UpdateOutput1;"
  cursor = connection.cursor()
  cursor.execute(query)
  cursor.fetchone()
  </code></pre>
  
  <p>When im doing cursor.fetchone() , i am getting following error.</p>
  
  <pre><code>File "&lt;ipython-input-1398-bdaba305080c&gt;", line 1, in &lt;module&gt;
      cursor.fetchone()
  
  ProgrammingError: No results.  Previous SQL was not a query.
  </code></pre>
  
  <p>Is there any error in pyodbc package? or in my query</p>