python 操作sqlserver

import pyodbc
connection = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=Mide12;UID=sa;PWD=google)
cur = connection.cursor()
cur.execute("select * from  XTSysRight")
for row in cur:
    print 'No:'+row.RightTypeNo,'RightName:'+row.RightTypeName

原文地址:https://www.cnblogs.com/foxhengxing/p/2113645.html