Prepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Parameter style for pymssql
is %-formatting, as in: cur.execute('select * from table where id=%d', id) cur.execute('select * from table where strname=%s', name) Please consult online documentation for more examples and guidelines.
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>> conn=pymssql.connect(host='IP', user='user', password='pass', database='bd')
>>> cur=conn.cursor()
>>> cur.execute('select * from tbl_tbl where clave=%d',123456)
>>> cur.fetchall()
here show all the results!
SO: Ubuntu 12.04LTS
python:2.7.3
pymssql: 1.0.2
freetds:0.91
Solved!!
Prepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Parameter style for pymssql
is %-formatting, as in: cur.execute('select * from table where id=%d', id) cur.execute('select * from table where strname=%s', name) Please consult online documentation for more examples and guidelines.
link: http:// www.sourcecodeb rowser. com/pymssql/ 1.0.2plus- pdfsg/pymssql_ 8py_source. html
Python 2.7.3 (default, Aug 1 2012, 05:16:07) connect( host='IP' , user='user', password='pass', database='bd')
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>> conn=pymssql.
>>> cur=conn.cursor()
>>> cur.execute('select * from tbl_tbl where clave=%d',123456)
>>> cur.fetchall()
here show all the results!
SO: Ubuntu 12.04LTS
python:2.7.3
pymssql: 1.0.2
freetds:0.91