当前位置:网站首页>Invalid operator for data type.The operator is add and the type is text.
Invalid operator for data type.The operator is add and the type is text.
2022-08-05 07:11:00 【51CTO】
Recently, when developing a file management system, I encountered another problem: the original local database was SQL2008, and there was a field SharedUserId of nvarchar(max) type.The query SQL statement uses...WHERE SharedUserId + ',' LIKE '%2,%', which can be executed normally.Later, I released the program to the space server I bought. The server is the database of SQL2000. Because SQL2000 does not have the nvarchar(max) type, I even changed it to the text type. As a result, the program reported an error when executing the same SQL statement:
So, I even changed the local database field type to text, and then tested it, and a similar error was reported (even the SQL2008 is in English):
After searching on the Internet, the original query statement was slightly modified (convert text to nvarchar and then perform + operation), and it worked:...WHERE SharedUserId + ',' LIKE '%2,%' is replaced by...WHERE CAST(SharedUserId AS NVARCHAR) + ',' LIKE '%2,%' or WHERE CONVERT(NVARCHAR, SharedUserId) + ',' LIKE '%2,%'
边栏推荐
猜你喜欢
随机推荐
2022起重机司机(限桥式起重机)考试题库及模拟考试
DNSlog外带数据注入
工作3年,回想刚入门和现在的今昔对比,笑谈一下自己的测试生涯
2022熔化焊接与热切割操作证考试题及模拟考试
开启防火墙iptable规则后,系统网络变慢
Falsely bamboo brother today and found a localization of API to use tools
[instancetype type Objective-C]
共享内存+inotify机制实现多进程低延迟数据共享
Rapid Medical超小体积且唯一可调的取栓器获得FDA核准
693. 行程排序
开源中国活动合作说明书
怎么样避免线上内存泄漏
Modeling of the MAYA ship
Using printf function in STM32
Flink学习11:flink程序并行度
MySQL:连接查询 | 内连接,外连接
LabVIEW中如何实现任意形状的不规则按键
(2022杭电多校六)1012-Loop(单调栈+思维)
对数据类型而言运算符无效。运算符为 add,类型为 text。
自媒体人一般会从哪里找素材呢?