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) ,
入库类型 CHAR(1),
[入库数量] [numeric](18, 6) ,
[货位编码] [varchar] (10) ,
[批号] [varchar] (15) ,
[原因码] [varchar] (10) ,
[处理日期] [datetime] ,
[单据号] [int] )
insert into #入库(物料编码,入库类型,入库数量,货位编码,批号,原因码,处理日期,单据号)
select 物料编码,入库类型,入库数量,货位编码,批号,原因码,处理日期,单据号 from 入库
where 原因码>=@res_to AND 原因码 SELECT* FROM #入库