diff --git a/vn.data/test_pymssql.py b/vn.data/test_pymssql.py new file mode 100644 index 00000000..6eac6fd7 --- /dev/null +++ b/vn.data/test_pymssql.py @@ -0,0 +1,16 @@ +import pymssql +conn = pymssql.connect(server='stock.database.windows.net', port='1433',user='sqladmin@stock', password='7uhb*IJN', database='StockCn', charset="UTF-8", azure=True) +cur = conn.cursor() +cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))') +cur.executemany("INSERT INTO persons VALUES(%d, %s)", \ + [ (1, 'John Doe'), (2, 'Jane Doe') ]) +conn.commit() + +cur.execute('SELECT * FROM persons WHERE salesrep=%s', 'John Doe') +row = cur.fetchone() +while row: + print "ID=%d, Name=%s" % (row[0], row[1]) + row = cur.fetchone() + +conn.close() +