IF EXISTS(SELECT NAME FROM SYSOBJECTS WHERE NAME='出库单打印_PROC' AND TYPE='P')
DROP PROC 出库单打印_PROC
GO
CREATE PROC 出库单打印_PROC
@CO INT
AS
CREATE TABLE [#出库单打印] (
[销售单号] [int] NULL ,
[行] [int] NULL ,
[客户编码] [varchar] (10) ,
[物料编码] [varchar] (30) ,
[计量单位] [varchar] (10) ,
[出库数量] [numeric](18, 6) DEFAULT (0),
[退货数量] [numeric](18, 6)DEFAULT (0),
[出库日期] [datetime],
[销售员] [varchar] (10),
[仓库] [varchar] (10),
[货位] [varchar] (10) ,
[批号] VARCHAR(15))
INSERT INTO #出库单打印(销售单号,行,客户编码,物料编码,计量单位,
出库数量,退货数量,出库日期,销售员,仓库,货位,批号)
SELECT 销售单号,行,客户编码,物料编码,计量单位,
出库数量,退货数量,出库日期,销售员,仓库,货位,批号
FROM 销售出库单明细表
WHERE 销售单号=@CO
SELECT *FROM #出库单打印