select 
case when a1='' then null else a1 end a1,
case when a2='' then null else a1 end a2,
case when a3='' then null else a1 end a3
from a

解决方案 »

  1.   

    select isnull(a1,'字符') a1 ,isnull(a2,'字符') a2,isnull(a3,'字符') a3 from A
      

  2.   

    select isnull(a1,'null') a1,isnull(a2,'null') a2,isnull(a3,'null') a3 from a??
      

  3.   

    看错了!呵呵1
    select case when a1='' then 'null' else a1 end a1,
           case when a2='' then 'null' else a1 end a2,
           case when a3='' then 'null' else a1 end a3
    from A
      

  4.   

    select isnull(a1,'null') as fa1,isnull(a2,'null') as fa2 from A
      

  5.   

    select 
    case when a1='' then 'null' else a1 end a1,
    case when a2='' then 'null' else a1 end a2,
    case when a3='' then 'null' else a1 end a3
    from a
      

  6.   

    select a.id,case when b.b1='' then null else b.b1 end b.b1 from A a,B b where a.id=b.id这句话报错Line 1: Incorrect syntax near '.'. 哪里错了呢?
      

  7.   

    select a.id,case when b.b1='' then null else b.b1 end b.b1 from A a,B b where a.id=b.id这句话报错Line 1: Incorrect syntax near '.'. 哪里错了呢?
    少了一个","
    select a.id,case when b.b1='' then null else b.b1 end, b.b1 from A a,B b where a.id=b.id
      

  8.   

    不好意思,看错了:试试这个
    select a.id,(case when b.b1='' then null else b.b1 end) b.b1 from A a,B b where a.id=b.id