当前位置:网站首页>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,%'
边栏推荐
- MySQL:连接查询 | 内连接,外连接
- Libpq 是否支持读写分离配置
- Hong Kong International Jewellery Show and Hong Kong International Diamond, Gem and Pearl Show kick off
- 软件测试必问面试题(附答案和解析)
- RNote108---显示R程序的运行进度
- MySQL表操作练习
- typescript62-泛型工具类型(record)
- It turns out that Maya Arnold can also render high-quality works!Awesome Tips
- 【动态类型检测 Objective-C】
- typescript61-泛型工具类型(pick)
猜你喜欢
随机推荐
Source code analysis of Nacos configuration service (full)
How to avoid online memory leaks
Database table insert data
腾讯业务安全岗 IDP 谈话总结
HR:这样的简历我只看了5秒就扔了,软件测试简历模板想要的进。
After working for 3 years, I recalled the comparison between the past and the present when I first started, and joked about my testing career
给网站套上Cloudflare(以腾讯云为例)
C# FileSystemWatcher
RK3568环境安装
Using printf function in STM32
今天虚竹哥又发现了一款好用的国产化API工具
Rapid Medical's Ultra-Small and Only Adjustable Thromb Retriever Receives FDA Clearance
性能提升400倍丨外汇掉期估值计算优化案例
Mysql master-slave delay reasons and solutions
不能比较或排序 text、ntext 和 image 数据类型
铠侠携手Aerospike提升数据库应用性能
怎么样避免线上内存泄漏
Redis
typescript65-映射类型(keyof)
RNote108---显示R程序的运行进度









