Guest User

Untitled

a guest
Jun 28th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # on mac terminal
  2. # > brew install freetds@0.91
  3. # > brew link --overwrite --force freetds@0.91
  4. # > pip install pymssql
  5.  
  6. import pymssql
  7. conn = pymssql.connect(server='test.server.com', user='mega', password='pass', database='db')
  8. cursor = conn.cursor()
  9. cursor.execute('select top 10 * from dbo.tab;')
  10. row = cursor.fetchone()
  11. while row:
  12. print (str(row[0]) + " " + str(row[1]) + " " + str(row[2]) + " " + str(row[3]) )
  13. row = cursor.fetchone()
Add Comment
Please, Sign In to add comment