当前位置:网站首页>数据类型 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’
边栏推荐
- 中职组网络安全C模块全漏洞脚本讲解包含4个漏洞的脚本
- Go项目实战—参数绑定,类型转换
- What are the top ten securities companies? Is it safe to open an account online?
- 埋点111
- Explanation of full vulnerability script of network security C module of secondary vocational group script containing 4 vulnerabilities
- Pseudo class elements -- before and after
- PWA (Progressive Web App)
- go语言学习笔记-初识Go语言
- Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
- AD20 制作 Logo
猜你喜欢

SAP UI5 ObjectPageLayout 控件使用方法分享

重磅:国产IDE发布,由阿里研发,完全开源!

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

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

Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level

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

Learning notes 5 - high precision map solution

关于vray 5.2的使用(自研笔记)

一次edu证书站的挖掘

【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
随机推荐
关于 “原型” 的那些事你真的理解了吗?【上篇】
2022年流动式起重机司机考试题库及模拟考试
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
“军备竞赛”时期的对比学习
函数///
使用bat命令一键启动常用浏览器
go语言学习笔记-初识Go语言
In the year of "mutual entanglement" of mobile phone manufacturers, the "machine sea tactics" failed, and the "slow pace" playing method rose
TSQL–标示列、GUID 、序列
Common functions of go-2-vim IDE
A usage example that can be compatible with various database transactions
一个可以兼容各种数据库事务的使用范例
关于vray 5.2的使用(自研笔记)(二)
微信核酸检测预约小程序系统毕业设计毕设(6)开题答辩PPT
BOM//
AD20 制作 Logo
Go project practice - parameter binding, type conversion
脚手架开发进阶
Go language-1-development environment configuration
Taro advanced