当前位置:网站首页>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,%'
边栏推荐
- Hong Kong International Jewellery Show and Hong Kong International Diamond, Gem and Pearl Show kick off
- Put Cloudflare on the website (take Tencent Cloud as an example)
- Bluetooth gap protocol
- 2022熔化焊接与热切割操作证考试题及模拟考试
- FPGA解析B码----连载4
- 真实字节跳动测试开发面试题,拿下年薪50万offer。
- Shiny04---DT和进度条在shiny中的应用
- 2022.7.29好题选讲(计数专题)
- RNote108---Display the running progress of the R program
- Mysql master-slave delay reasons and solutions
猜你喜欢
随机推荐
The NDK compiler so libraries
字节面试流程及面试题无私奉献,吐血整理
2022 crane driver (limited bridge crane) exam question bank and simulation test
GAN generates anime avatar Pytorch
MySQL:JDBC编程
腾讯业务安全岗 IDP 谈话总结
【Go】IM系统Centrifugo
Hash 这些知识你也应该知道
AI + video technology helps to ensure campus security, how to build a campus intelligent security platform?
Day9 of Hegong Daqiong team vision team training - camera calibration
不太会讲爱,其实已经偷偷幸福很久啦----我们的故事
MySQL: JDBC programming
浮点数基础知识
400 times performance improvement 丨 swap valuation optimization case calculation
Put Cloudflare on the website (take Tencent Cloud as an example)
Advanced Redis
IO process thread -> communication between processes -> day7
Takeda Fiscal 2022 First Quarter Results Strong; On Track to Achieve Full-Year Management Guidance
Shiny02---Shiny exception solution
DevExpress中针对指定列进行百分比转换









