关于存储过程的输出参数问题
这是小弟的产生订单的存储过程:
CREATE PROCEDURE generateorder (@ticketnostring varchar(300),@fare money,@orderby varchar(30),@contactname varchar(30),
@contactcellphone varchar(20),@contactphone varchar(30),@contactemail varchar(50),@getticketno varchar(20) OUTPUT)
AS
DECLARE @orderID VARCHAR(50),
@date DATETIME,
@no INT,
@BIG BIGINT
declare @NewID CHAR(14)
declare @year CHAR(4)
declare @month char(2)
declare @day char(2)
SET @date=GETDATE()
SET @year = cast(year(getdate()) as char)
SET @month = CAST(month(getdate()) as char)
SET @day = cast(day(getdate()) as char)
SET @NewID = replace((@year+@month+@day), ' ', ' ') + '000001 '
SET @BIG=@NewID
--SELECT @NewID
--SELECT * FROM 订单信息表
--SELECT MAX(订单编号) FROM 订单信息表
--ELECT MIN(订单编号) FROM 订单信息表
WHILE 1> 0
BEGIN
IF(EXISTS(SELECT * FROM 订单信息表 WHERE 订单编号=@BIG))
BEGIN
SET @BIG = @BIG + 1
END
ELSE
BREAK
END
SET @NewID=@BIG
INSERT INTO 订单信息表 VALUES(@NewID,@ticketnostring,@orderby,@fare,@date,@contactname ,@contactcellphone ,@contactphone,@contactemail)
SELECT @getticketno= @NewID
GO
这个过程没有错;
下面是我的调用代码: