下载后可任意编辑sqlserver 存储过程例子tSellOut tSellBackfCustomerIDfSubmitDatefNOfID顾客发货日序号标识TSellOutSub tSellBackSubfIDfResIDfQtyfUnitPrice标识产品号数量金额CREATE PROCEDURE CustomerTotal @CustomerID int, @BeginDate Datetime, @EndDate DatetimeASBeginSet NoCount OnDeclare @CustomerStockIO Table --临时表(fDate Datetime,fNote nvarchar(10),fNO nvarchar(20),fFlag int not null default 0,fProductID int,fQty numeric(10,2),fUnitPrice numeric(10,2))Insert Into @CustomerStockIOSelect a
fSubmitDate,'出货',a
fNO,0,b
fResID,b
fQty,b
fUnitPricefrom tSellOut a,tSellOutSub bwhere a
fID and a
fCustomerID=@CustomerID and a
fSubmitDate>=@BeginDate and a
fSubmitDate=@BeginDate and a
fSubmitDate @@rowcount = 0 on -->允许 SQL 记录影响的行数 SET NOCOUNT ON SELECT 1 ----------- 1 SET NOCOUNT OFF SELECT 1 ----------- 1 (所影响的行数为 1 行) -