Home >Database >Mysql Tutorial >mssql查找备注(text,ntext)类型字段为空的方法

mssql查找备注(text,ntext)类型字段为空的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:57:341583browse

在sql语句中,如果查找某个文本字段值为空的,可以用select * from 表 where 字段='' ,但是如果这个字段数据类型是text或者ntext,那上面的sql语句就要出错了。

解决办法有很多:

1 . select * from 表 where datalength(字段)=0

2. select * from 表 where cast(字段 as varchar(100))=''

3. select * from 表 where 字段 like ''

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn