首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sqlserver 批量增添和修改语句用select

2012-08-07 
sqlserver 批量添加和修改语句用select修改语句:beginupdate PRODUCE_TASKSDETAIL set gcounta.gcount+ca

sqlserver 批量添加和修改语句用select

修改语句:

beginupdate PRODUCE_TASKSDETAIL set gcount=a.gcount+                           case c.STANDBATCH                            when '0' then @unitCount*b.STANDBATCH                            else @unitCount/c.STANDBATCH*b.STANDBATCH                           end            from PRODUCE_TASKSDETAIL as a,PRODUCE_BOM_SUB as b,PRODUCE_BOM_BOM as c            where a.goodsid=b.goodsid and b.BOMID=c.BOMID and c.GOODSID=@goodsId and a.tasksid=@tasksId         end

?添加语句:

begin    insert into PRODUCE_TASKSDETAIL(SALEORDER_BILLCODE,TASKSID,GOODSID,UNITID,goodsCount,GCOUNT,GPRICE)                   select @billCode,@tasksId,a.GOODSID,a.UNITID,a.STANDBATCH,                           case c.STANDBATCH                            when '0' then @unitCount*a.STANDBATCH                            else @unitCount/c.STANDBATCH*a.STANDBATCH                           end                          ,b.APRICE from PRODUCE_BOM_SUB as a,BASE_GOODS as b,PRODUCE_BOM_BOM as c                   where a.GOODSID=b.GOODSID and a.BOMID=c.BOMID and a.BOMID in(select BOMID from PRODUCE_BOM_BOM where GOODSID=@goodsId) end
?

热点排行