----try
select top 1 * from news where (npic is not null or rtrim(ltrim(npic))<>'') and 
type=1 and look=1 order by ndate desc 

解决方案 »

  1.   

    你到底是需要NULL还是不需要NULL?select top 1 * from news where npic is null and type=1 and look=1 order by ndate desc 
      

  2.   


    create table test(name varchar(10))
    insert test select 'a' union all
    select null union all
    select 'b'
    goselect * from testname       
    ---------- 
    a
    NULL
    b(所影响的行数为 3 行)select * from test where name is not null;name       
    ---------- 
    a
    b(所影响的行数为 2 行)
      

  3.   

    npic是保存图片路径的,我要把有路径的搜索出来,空的就不搜了
      

  4.   

    --try:
    select top 1 * from news where isnull(npic,N'')<>N'' and type=1 and look=1 order by ndate desc 
      

  5.   

    楼主的语句没问题,是不是和npic字段类型有关系?什么类型的?
      

  6.   

    字段若要是真是NULL,记录集会以NULL来显示,要是空白的话表示不是NULL,而是空字符串
      

  7.   

    最好考虑空串''和空null两种类型的