存储过程中的输出参数始终返回0

时间:2015-03-27 07:22:00

标签: php sql-server stored-procedures

@Lalue在insert语句中使用时得到了正确的值。但是,当使用php调用此存储过程时,@ AID(设置为@Value)始终为0。

ALTER PROCEDURE [dbo].[UpdateActivity2]
@ParentActivity int,
@ActivityName varchar(150),
@ActivityType int,
@ActivityStatus int,
@Descr varchar(1024),
@RegistrationDate datetime,
@FinishDate datetime,
@Owner int,
@SourceID int,
@ContactID int,
@ActivityAddress varchar(150),
@ExtReference varchar(50),
@ResponsibleCompanyID int,
@AID int OUTPUT
AS
BEGIN
DECLARE @Value int;
EXEC @Value =  PG_GetSeq @Name = 'Activity'
INSERT INTO Activity(
                ActivityID, 
                ParentActivity, 
                ActivityName, 
                ActivityType, 
                ActivityStatus, 
                Descr, 
                RegistrationDate, 
                FinishDate, 
                Owner, 
                SourceID, 
                ContactID, 
                ActivityAddress, 
                ExtReference, 
                ResponsibleCompanyID
            )
            VALUES(
                @Value, 
                @ParentActivity, 
                @ActivityName, 
                @ActivityType, 
                @ActivityStatus, 
                @Descr, 
                @RegistrationDate, 
                @FinishDate, 
                @Owner, 
                @SourceID, 
                @ContactID, 
                @ActivityAddress, 
                @ExtReference, 
                @ResponsibleCompanyID
            )

    SELECT @AID = @Value
END

我在这里做错了什么?它与在另一个存储过程中调用存储过程有关吗?

0 个答案:

没有答案