当前位置:编程学习 > C#/ASP.NET >>

怎么查询空字段!!!!

大家帮帮忙!!!模糊查询的时候怎么查询空字段啊?
用like‘%%’都不是出全部数据啊!!含有空字段的没出来哦1!! --------------------编程问答-------------------- 后面加 and 字段名 is null --------------------编程问答-------------------- where (name='' or name is null) --------------------编程问答--------------------
引用 2 楼 qq346127416 的回复:
where (name='' or name is null)

+ --------------------编程问答--------------------

where len(查询内容)>0 

--------------------编程问答-------------------- --------------------编程问答-------------------- where (name='' or name is null)
+2 --------------------编程问答--------------------
引用 4 楼 yksyuan 的回复:
SQL code

where len(查询内容)>0

+1 --------------------编程问答-------------------- <td colspan =4 align =left style="background-color: #ECECFF; font-size: large; font-weight: bold;">
    
      板块列表
--------------------编程问答--------------------
引用 8 楼 mfr496265873 的回复:
<td colspan =4 align =left style="background-color: #ECECFF; font-size: large; font-weight: bold;">
   
  &nbsp;&nbsp;&nbsp;&nbsp;板块列表

+1 --------------------编程问答-------------------- where (name='' or name is null)
+3 --------------------编程问答-------------------- 用 or 。。。is null 的话 到时候当条 like‘%**%’时,空的也会出来!!!这样不行! --------------------编程问答-------------------- where len(name)=0

已经有兄弟给出这个方法了,我只是重复一下,以便引起楼主的参考。 --------------------编程问答-------------------- “” --------------------编程问答--------------------
引用 2 楼 qq346127416 的回复:
where (name='' or name is null)

+    满足当前条件和  当前条件为空的
--------------------编程问答-------------------- where (name='' or name is null) --------------------编程问答-------------------- 你这么写 看看
select * from 表名 where 模糊字段名 like'%模糊字符%' or 模糊字段名 is null --------------------编程问答-------------------- isnull(字段,'')<>'' --------------------编程问答--------------------
引用 2 楼 qq346127416 的回复:
where (name='' or name is null)


同意 --------------------编程问答-------------------- where (name like '%%' or name is null)
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,