case when  Boolean_expression then 值1 else 值2 end

解决方案 »

  1.   

    case when Boolean_expression then 值1 else 值2 end
      

  2.   

    测试:
    declare @a int,@b int
    select @a=5,@b=6
    select case when @a>@b then 1 else 0 end
      

  3.   

    case Boolean_expression when 1 then 值1 else 值2 end
      

  4.   

    IIf(«Logical Expression», «Numeric Expression1», «Numeric Expression2»)如果 «Logical Expression» 取值为 TRUE,则此函数返回 «Numeric Expression1»,否则,返回 «Numeric Expression2»。
      

  5.   

    我觉的回复人: 
    yefengdn(我爱我家)  这个最符合我的要求,大家认为呢??
    --------------------------
       IIf(«Logical Expression», «Numeric Expression1», «Numeric Expression2»)如果 «Logical Expression» 取值为 TRUE,则此函数返回 «Numeric Expression1»,否则,返回 «Numeric Expression2»。
      
     
      

  6.   

    奇怪,iif这个函数不能在查询分析器里用,这个是那里用的哦??