title: SQL Server temp table not available in pyodbc code
body: <p>I'm running a series of complex sql queries in python and it involves temp tables. My auto-commit method doesn't seem to be working to retrieve the data from the temp table. The code snippet I'm using below and this is the output I'm getting: </p>
  
  <pre><code>testQuery="""
      Select top 10 *
      INTO #Temp1
      FROM Table1 t1
      JOIN Table2 t2
      on t1.key=t2.key
  """
      cnxn=pyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};SERVER=server;DATABASE=DB;UID=UID;PWD=PWD')
      cnxn.autocommit=True
      cursor=cnxn.cursor()
      cursor.execute(testQuery)
      cursor.execute("""Select top 10 * from #Temp1""")
      &lt;pyodbc.Cursor at 0x8f78930&gt;
  
  
  cnxn=pyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};SERVER=server;DATABASE=DB;UID=UID;PWD=PWD')
  cnxn.autocommit=True
  cursor=cnxn.cursor()
  cursor.execute(testQuery)
  cursor.execute("""Select top 10 * from #Temp1""")
  </code></pre>