当前位置:网站首页>数据类型 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’
边栏推荐
猜你喜欢

Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv

磨礪·聚變|知道創宇移動端官網煥新上線,開啟數字安全之旅!

磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
![[paper reading] kgat: knowledge graph attention network for recommendation](/img/fa/d2061bc7bd437f062d46a009cf32cf.png)
[paper reading] kgat: knowledge graph attention network for recommendation

Web3 Foundation grant program empowers developers to review four successful projects

Implement the rising edge in C #, and simulate the PLC environment to verify the difference between if statement using the rising edge and not using the rising edge

LSTM应用于MNIST数据集分类(与CNN做对比)

微信核酸检测预约小程序系统毕业设计毕设(7)中期检查报告

SAP ui5 objectpagelayout control usage sharing

Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
随机推荐
跨页面通讯
使用GBase 8c数据库过程中报错:80000502,Cluster:%s is busy,是怎么回事?
Array
沟通的艺术III:看人之间 之倾听
Network security of secondary vocational group 2021 Jiangsu provincial competition 5 sets of topics environment + analysis of all necessary private messages I
iframe
ModuleNotFoundError: No module named ‘scrapy‘ 终极解决方式
Advanced scaffold development
websocket
2021 Shandong provincial competition question bank topic capture
5G NR系统架构
Buried point 111
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
关于vray 5.2的使用(自研笔记)
函数///
【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
风控模型启用前的最后一道工序,80%的童鞋在这都踩坑
数据类型、
[paper reading] kgat: knowledge graph attention network for recommendation
How can non-technical departments participate in Devops?