[英]SQL Server error - Operand type clash: ntext is incompatible with int - (I'm not even using "ntext")
One of the columns I'm operating on is:我正在操作的专栏之一是:
Comments VARCHAR(8000)
So basically I'm trying to insert a large text of up to even 600 characters into this column Comments
.所以基本上我试图在此列
Comments
插入最多 600 个字符的大文本。 When I run my script everything goes smoothly for first 10 rows then all of a sudden I get this error:当我运行我的脚本时,前 10 行一切顺利,然后突然我收到此错误:
pypyodbc.DataError: ('22018', '[22018] [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: ntext is incompatible with int')
pypyodbc.DataError: ('22018', '[22018] [Microsoft][ODBC SQL Server Driver][SQL Server]操作数类型冲突:ntext 与 int 不兼容')
Then again if I rerun the query, everything will start going smoothly for next 10 rows and as you might have guessed by now I get the same error again.然后,如果我再次运行查询,接下来的 10 行一切都会开始顺利进行,正如您现在可能已经猜到的那样,我再次遇到相同的错误。
What can I do to fix this?我能做些什么来解决这个问题?
Edit :编辑:
I have tried using VARCHAR(MAX)
, NVARCHAR(MAX)
, VARCHAR(800)
, TEXT
.我曾尝试使用
VARCHAR(MAX)
、 NVARCHAR(MAX)
、 VARCHAR(800)
、 TEXT
。 I get the same error every time.我每次都会遇到同样的错误。
I wonder whether it is a problem with the data on row 10?请问是不是第10行的数据有问题? To test this, try deleting the data on, say, row 5, and see whether the error starts on row 9.
要对此进行测试,请尝试删除第 5 行上的数据,然后查看错误是否从第 9 行开始。
I would recommend you using pmyssql instead of pypyodbc.我建议您使用pmyssql而不是 pypyodbc。 Seems like it is a driver level issue and switching to pymssql might help.
似乎这是一个驱动程序级别的问题,切换到 pymssql 可能会有所帮助。 Please follow the ACOM doc and let me know if that helps.
请遵循 ACOM 文档,如果有帮助,请告诉我。 If you still run into the same issue let me know as I can further try to help you.
如果您仍然遇到同样的问题,请告诉我,因为我可以进一步尝试帮助您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.