最后一句改成update a set iid2=b.iid from @temp a,@temp2 b where a.w=b.w表变量名不能作为字段标示,必须起别名

解决方案 »

  1.   

    最後一句:
    declare @sql varchar(8000)
    set @sql='update '+@temp1+' set iid2=b.iid from '+@temp2+' 
               where '+@temp1+'.w='+@temp2+'.w'
    exec(@sql)
      

  2.   

    To LouisXIV(夜游神):  
    最后一句改成
    update a set iid2=b.iid from @temp a,@temp2 b where a.w=b.w
    表变量名不能作为字段标示,必须起别名
    ---------------------------------------------這樣可以嗎? 我試了下,好像還是報錯的哇...
    請教~~~