表A 中有两个字段 A_1,   A_2
我要查找A_1 = '小明' 的结果,并且要求 A_2 为空时,就修改A_2的值为 '18',如果A_2不为空, 就不修改A_2的值.要SQL语句

解决方案 »

  1.   

    update table a set A_2 = '18' 
    where A_1='小明' and A_2=''
      

  2.   

    update A set A_2='18' where A_1='小明' and ltrim(rtrim(A_2))=''

    update A set A_2='18' where A_1='小明' and (A_2 is null)
      

  3.   

    一条SQL语句?
    自从做了一个同时支持多种数据库平台的系统,复杂SQL语句基本不敢写了,唉
      

  4.   

    update table a set A_2 = '18' where A_1='小明' and isnull(A_2,'')=''
      

  5.   


    update table a set A_2 = '18' where A_1='小明' and isnull(A_2,'')='' 
      

  6.   

    update table1 set A_2 = '18'
    where A_1 = '小明' and A_2 = ''
      

  7.   

    update A set A_2='18' where A_1='小明' and ltrim(rtrim(A_2))='' 
      

  8.   

    update A set A_2 =18 where A_1 = '小明' and A_2 is null
      

  9.   

    update database a set A_2=18 where A_1='小明' and isnull(A_2,'') =''