update a,b
set a.cinvcode = 'B0101002',b.cinvcode='B0101002'
from cbom a,cbomson b
where a.cinvcode = 'B0102003' and b.cinvcode='B0102003'
以上更新SQL语句,报语法错误,如何修改呢,

解决方案 »

  1.   

    update cbom set cinvcode = 'B0101002' where cinvcode = 'B0102003'
    update cbomson set cinvcode = 'B0101002' where cinvcode = 'B0102003'
      

  2.   

    update a 
    set cinvcode = 'B0101002'
    where cinvcode = 'B0102003' update b 
    set cinvcode = 'B0101002'
    where cinvcode = 'B0102003' 
      

  3.   

    CREATE PROC P
    AS 
     BEGIN
          update a 
    set a.cinvcode = 'B0101002'
    from cbom a
    where a.cinvcode = 'B0102003' update b 
    set b.cinvcode='B0101002' 
    from cbomson b 
    where  b.cinvcode='B0102003' 
    END
      

  4.   


    update a
    set a.cinvcode = 'B0101002'
    from cbom a,cbomson b 
    where a.cinvcode = 'B0102003' and b.cinvcode='B0102003' update b 
    set b.cinvcode='B0101002' 
    from cbom a,cbomson b 
    where a.cinvcode = 'B0102003' and b.cinvcode='B0102003' 
      

  5.   

    UPDATE不能一次更新两行 需要写成两条语句
      

  6.   

    分开写
    update a 
    set cinvcode = 'B0101002' 
    where cinvcode = 'B0102003' update b 
    set cinvcode = 'B0101002' 
    where cinvcode = 'B0102003' 
      

  7.   

    UPDATE不支持两行更新,分行写。
      

  8.   

    只能用2句来完成
    update cbom set cinvcode = 'B0101002'
    where cinvcode = 'B0102003'
    update cbomson set cinvcode = 'B0101002'
    where cinvcode = 'B0102003'