sqlstr="insert into RCGZJLK(cphm,khxm,xhcs,xhdj,xhje,zffs,cardno,khmc,sfrq,jlzt,czyh) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s') " % (cphm,khxm,xhcs,xhdj,xhje,zffs,cardno,khmc,st,'0',czyh)
cursor.execute(sqlstr)
错误提示:
cursor.execute(sqlstr)
File "C:\Python25\Lib\site-packages\pymssql.py", line 188, in execute
raise OperationalError, e[0]
pymssql.OperationalError: SQL Server message 8152, severity 16, state 9, line 1:
将截断字符串或二进制数据。
但是如果你修改成
sqlstr="insert into RCGZJLK(cphm,khxm,xhcs,xhdj) values('%s','%s','%s','%s') " % (cphm,khxm,xhcs,xhdj)
就能插入!不晓得如何处理! |