一个表里有两列:主键列、image列。
现在表里有10w条记录,但是image列里只有条记录不为空,我想把为空的记录都更新成不为空的记录值。表:A
列:ID  主键
    Photo image类型的列
有什么方法吗?

解决方案 »

  1.   

    update A set Photo='' where Photo is null
      

  2.   

    Update A
    Set Photo = ''
    Where Photo Is NULL还是想将Photo改为其它ID的Photo值啊?
      

  3.   

    update t 
    set 
        Photo=(select Photo from A where Photo is not null) 
    from
        A t
    where t.Photo is null
      

  4.   

    DB_Jackaroo() ( ) 信誉:100    Blog   加为好友  2007-05-09 17:32:28  得分: 0  
     
     
       我想改成不为那个为空的值
      
    ------------------------------------------
    随便取哪一个不为空的值吗?
    Update A
    Set Photo = (select top 1 aa.Photo From A aa Where Photo is not null)
    From A
    Where Photo Is NULL
      

  5.   

    这样不可以,报下面的错误,问题是photo是image类型的在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效。
      

  6.   

    在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效。-------------------------------------------------------------这样子的啊?
      

  7.   

    update m 
    set 
        Photo=n.Photo 
    from 
        A m,A n 
    where 
        m.Photo is null 
        and 
        n.Photo is not null