日期:2014-05-16 浏览次数:20706 次
create proc testproductstock2
(@dcode varchar(20),
@funcid int,
@model int)
as
begin
set nocount on
if @model=1
begin
select * from v_rukutest b
select * from productstock a
update a
set stock=isnull(stock,0)+isnull(b.basedigit,0)
from productstock a,v_rukutest b
where a.factorycode=b.factorycode and a.productcode=b.productcode
and a.storagecode=b.storagecode and a.batchcode=b.batchcode
end
if not exists (select 1
from productstock a,v_rukutest b
where a.factorycode=b.factorycode and b.productcode=a.productcode
and b.storagecode=a.storagecode and b.batchcode=a.batchcode)
insert into productstock (factorycode,storagecode,productcode,batchcode,stock)
select factorycode,storagecode,productcode,batchcode,basedigit
from v_rukutest
where dcode=@dcode
return
end
create proc testproductstock2
@dcode varchar(20),
@funcid int,
@model int
as
begin
set nocount on
if @model =1
begin
select * from v_rukutest b
select * from productstock a
update a set
stock = isnull(stock,0)+isnull(b.basedigit,0) FROM productstock AS a,v_rukutest AS b
where a.factorycode=b.factorycode and a.productcode=b.productcode
and a.storagecode=b.storagecode and a.batchcode=b.batchcode
end
if not exists (