102, b"Incorrect syntax near 'xxxxxx'.DB-Lib error message 20018, severity 15:\nGeneral SQL Serve

t.publicSql_select(sql="SELECT soid from SO where  ThirdPartySoSysNo=%s"%outtradeno,database="test")

执行到这条语句报错:
File “src\pymssql.pyx”, line 465, in pymssql.Cursor.execute
pymssql.ProgrammingError: (102, b"Incorrect syntax near ‘Xxxxx’.DB-Lib error message 20018, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\n")

修改:

t.publicSql_select(sql="SELECT soid from SO where  ThirdPartySoSysNo='%s'"%(outtradeno),database="test")

最后还是自己写的ThirdPartySoSysNo = 调用的变量格式有问题,如果出现类似问题,请检查自己这段代码

你可能感兴趣的:(python)