IF EXISTS(SELECT NAME FROM SYSOBJECTS WHERE NAME='库存调整_原因_PROC' AND TYPE='P')
DROP PROC 库存调整_原因_PROC
GO
create procedure 库存调整_原因_PROC
@res_to varchar (10),
@res_fr varchar (10)
as
CREATE TABLE [#库存调整]
(
[物料编码] [varchar] (30),
[计量单位] [varchar] (10),
[调整数量] [numeric](18, 6),
[仓库] [varchar] (10),
[货位编码] [varchar] (10),
[批号] [varchar] (15),
[原因码] [varchar] (10),
[处理日期] [datetime] )
insert into #库存调整(物料编码,计量单位,调整数量,仓库,货位编码,批号,原因码,处理日期)
select 物料编码,计量单位,调整数量,仓库,货位编码,批号,原因码,处理日期
from 库存调整 where 原因码>=@res_to AND 原因码 SELECT* FROM #库存调整