update data_a 
set field_a=case when 1 then 2 else 3 end

解决方案 »

  1.   

    1--布尔表达式
    2,3的类型与field_a相容。
      

  2.   

    偶怎么看不懂楼上的回答阿
    郁闷ing
      

  3.   

    试试下面的存储过程create procedure xxxx
       @id int
    as
    update taa set name=(case @id when 2 then 0 else 10 end)
    exec xxxx 2
      

  4.   

    是否 iif在SQL Server中无法使用的
      

  5.   

    SQL Server中没有iif()函数。
    就只能用CASE WHEN ELSE END来替换。如:
    declare @id int
    set @id = 1
    update data_a set field_a = (case @id when 1 then 2 else 3 end)
      

  6.   

    iff是类似于条件表达式的函数?
    sqlserver没的亚!
      

  7.   

    IFF看来还挺好用的嘛,为何SQL SERVER 没有?不解!