google-code-export / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Insert data from one table to another table not working #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Execute following query using pymssql
   SELECT * INTO NewTable FROM OldTable
2. Execute same query using MicroSoft SQL server management studio

What is the expected output? What do you see instead?
In both steps, NewTable should get created with all the contents of OldTable. 
NewTable not get created for step 1.

What version of the product are you using? On what operating system?
2.0.0 (OS: Linux 2.6.32-5-xen-amd64)

Please provide any additional information below.
None

Original issue reported on code.google.com by maheshmo...@gmail.com on 29 Mar 2012 at 1:25

GoogleCodeExporter commented 9 years ago
Are you issuing a commit afterwards? db-api drivers are transactional by 
default so for any changes to be applied you'll need to issue one.

Original comment by dam...@gmail.com on 3 May 2012 at 12:45

GoogleCodeExporter commented 9 years ago
marca@marca-mac:~/dev/hg-repos/pymssql$ cat issue_87.py
import pymssql

conn = 
pymssql.connect(host="xxx",user="xxx",password="xxx$",database="xxx",as_dict=Tru
e)
cur = conn.cursor()
cur.execute("SELECT * INTO test_table2 FROM test_table")
# conn.commit()

marca@marca-mac:~/dev/hg-repos/pymssql$ python2.6 issue_87.py

# test_table2 not showing up in SSMS (because Python program didn't commit 
transaction)

marca@marca-mac:~/dev/hg-repos/pymssql$ cat issue_87.py
import pymssql

conn = 
pymssql.connect(host="xxx",user="xxx",password="xxx$",database="xxx",as_dict=Tru
e)
cur = conn.cursor()
cur.execute("SELECT * INTO test_table2 FROM test_table")
conn.commit()  # <-- Now we commit

marca@marca-mac:~/dev/hg-repos/pymssql$ python2.6 issue_87.py

# test_table2 shows up in SSMS (because Python program did commit transaction)

So I think this can be closed.

Original comment by msabr...@gmail.com on 7 Aug 2013 at 3:28

GoogleCodeExporter commented 9 years ago

Original comment by msabr...@gmail.com on 7 Aug 2013 at 3:37