当前位置:网站首页>数据类型 ntext 和 varchar 在not equal to 运算符中不兼容 -九五小庞
数据类型 ntext 和 varchar 在not equal to 运算符中不兼容 -九五小庞
2022-07-05 10:35:00 【九五小庞】
SQL语句:select * from A where test=’xxx’
执行之后会出现:
数据类型 ntext 和 varchar 在 equal to 运算符中不兼容的错误信息。
是不是值也是ntext类型就行了呢?
那把SQL语句该成:select * from A where test=convert(ntext,’xxx’)
结果出现:数据类型 ntext 和 ntext 在 equal to 运算符中不兼容的错误信息。
解决这个问题有2种办法:
1.直接改数据库字段类型。。。。(不治本)
2.把SQL语句修改为:
select * from A where convert(nvarchar(255),test)=’xxx’
因为不管是text还是nvarchar,实体类中的影射都应该是string,因为C#只有一个string是用来表示字符串的,不过这两个数据类型在数据库中是完全不同的,所以无法在他们之间进行比较操作,尤其那个ntext,很多操作都不能做,就算是两个ntext类型,也没有办法进行比较操作。也可以select * from A where test like’xxx’
边栏推荐
猜你喜欢
DGL中的消息传递相关内容的讲解
关于 “原型” 的那些事你真的理解了吗?【上篇】
基于昇腾AI丨以萨技术推出视频图像全目标结构化解决方案,达到业界领先水平
Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
Based on shengteng AI Aibi intelligence, we launched a digital solution for bank outlets to achieve full digital coverage of information from headquarters to outlets
2022年化工自动化控制仪表考试试题及在线模拟考试
Learning note 4 -- Key Technologies of high-precision map (Part 2)
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
【DNS】“Can‘t resolve host“ as non-root user, but works fine as root
随机推荐
非技術部門,如何參與 DevOps?
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
Web3 Foundation grant program empowers developers to review four successful projects
Go language-1-development environment configuration
关于vray 5.2的使用(自研笔记)(二)
一个可以兼容各种数据库事务的使用范例
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
C#实现获取DevExpress中GridView表格进行过滤或排序后的数据
正则表达式
2022年危险化学品生产单位安全生产管理人员特种作业证考试题库模拟考试平台操作
微信核酸检测预约小程序系统毕业设计毕设(6)开题答辩PPT
沟通的艺术III:看人之间 之倾听
Share Net lightweight ORM
谈谈对Flink框架中容错机制及状态的一致性的理解
“军备竞赛”时期的对比学习
赛克瑞浦动力电池首台产品正式下线
手机厂商“互卷”之年:“机海战术”失灵,“慢节奏”打法崛起
字符串、、
微信小程序触底加载与下拉刷新的实现
[JS] array dimensionality reduction