这样?
If (a = '' or a is null or a  = 'abc') and (b = '' or b is null or b  = 'def')

解决方案 »

  1.   


    If(Isnull(a,'')='' or a='abc') and (Isnull(b,'')='' or b='def')
      

  2.   


    case when Isnull(a,'')='' or a='abc' then ...
         when b = '' or b is null or b  = 'def' then ...
    end
      

  3.   

    If isnull(a,'') in ('','abc')
    ....If isnull(b,'') in ('','def') 
      

  4.   

     不好意思可能是我没有说清楚,
    /* 这是一个条件 */
    If a = '' or a is null 
       exec(@sql1+@sql2+@sql3)
    Else
       exec(@sql1+@sql2+@sql3+@a) 
    /* 这是另一个条件 */
    If b = '' or b is null 
       exec(@sql1+@sql2+@sql3)
    Else
       exec(@sql1+@sql2+@sql3+@b) 注意,我只是表达一下意思,上面的exec内容大家不需理会,因为条件A和B可能有多种组合方式,也就是A可能为空,B不为空;A不为空,B不为空;A,B均不为空...等多种组合关系
      

  5.   

    是这个意思:
    if isnull(a,'')='' then
    begin
      if isnull(b,'')='' then
       ........
      if isnull(b,'')<>'' then
       .........
    end
    else
    begin
      if isnull(b,'')='' then
       ........
      if isnull(b,'')<>'' then
       .........
    end