我的员工表中以员工身份证为关键字,
求一个sql语句,找出所有身份证不为空(有数据)的员工。谢谢了!再次感谢!

解决方案 »

  1.   

    select * from 表 where 身份证 is not null
      

  2.   

    所有记录
    select * from table where 身份证号 is not null or 身份证号=''记录条数
    select count(*) as 记录条数 from table where 身份证号 is not null or 身份证号=''
      

  3.   

    select count(*) from tablename where isnull(身份证号,'')=''
      

  4.   

    rfq(任凤泉) ( ) 信誉:98  2006-06-02 08:36:00  得分: 0  
     
     
       主键不能为空,怎么输进数据,不明白?
      
    ==========================================================
    对啊,
    LZ在开玩笑吧
      

  5.   

    楼上的……也太猛了吧……哈哈……试试这样咯:
    select * from table where 身份证号 is not null and ltrim(rtrim(身份证号))<>''
      

  6.   

    select * from table where ltrim(rtrim(身份证号))<>''
      

  7.   

    select * from table where 身份证号 is not null and ltrim(rtrim(身份证号))<>''
    的另一写法:
    SELECT * FROM TablName WHERE  LTRIM(RTRIM(ISNULL(身份证号,'')))<>''
    这样应可以解决楼主的问题了
      

  8.   

    select * from TABLE where len(FIELD)>0
      

  9.   

    select * from tableName where filedName like '%%'
      

  10.   

    哈哈我也来恶搞一下
    select count(*) from 表 where len(身份证) <> 0