python pymssql为什么连接到mssql执行错误

python pymssql为什么连接到mssql执行错误,python,pymssql,Python,Pymssql,下面的错误 #coding = utf8 __author__ = 'Administrator' import pymssql conn = pymssql.connect(host="211.1.1.1",user="hqyl", password = "ttt", database = "ticket") cur = conn.cursor() cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))') cur.execu

下面的错误

#coding = utf8
__author__ = 'Administrator'
import pymssql

conn = pymssql.connect(host="211.1.1.1",user="hqyl", password = "ttt", database = "ticket")
cur = conn.cursor()
cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))')
cur.executemany("INSERT INTO persons VALUES(%d, xinos.king)", \
    [ (1, 'John Doe'), (2, 'Jane Doe') ])
conn.commit()  # you must call commit() to persist your data if you don't set autocommit to True

cur.execute('SELECT * FROM persons WHERE salesrep=xinos.king', 'John Doe')
row = cur.fetchone()
while row:
    print "ID=%d, Name=xinos.king" % (row[0], row[1])
    row = cur.fetchone()

# if you call execute() with one argument, you can use % sign as usual
# (it loses its special meaning).
cur.execute("SELECT * FROM persons WHERE salesrep LIKE 'J%'")

conn.close()

您是否检查了sql server日志?如果它们与相关信息有关,则应包括在内。。。这只是一种预感,但从SQL Server错误判断:检查错误中来自SQL Server的消息,这可能会回答您的问题。用户hqyl没有在数据库中创建新表的权限。以管理员身份登录票证数据库,并向用户hqyl授予创建表的权限,即向hqyl授予创建表的权限;
Traceback (most recent call last):
  File "D:/python/t.py", line 7, in <module>
    cur.execute('CREATE TABLE persons(id INT, name VARCHAR(100))')
  File "pymssql.pyx", line 411, in pymssql.Cursor.execute (pymssql.c:5634)
pymssql.OperationalError: (262, "CREATE TABLE permission denied in database 'Ticket'. DB-Lib error message 262, severity 14:\nGeneral SQL Server error: Check messages from the SQL Server\n")