开发者

Assign value in integer returned from stored procedure + Sybase

开发者 https://www.devze.com 2023-04-06 17:42 出处:网络
I am calling a stored procedure from another stored procedure. That stored procedure is returning an integer value always so I am accepting that value in one integer variable.

I am calling a stored procedure from another stored procedure. That stored procedure is returning an integer value always so I am accepting that value in one integer variable.

EXEC @IsBusinessDay  =  LiteIsWorkingDay @ExecutionStart

But even if stored procedure returning 1 value of the @IsBusinessDay is 0.

Code block

SELECT @ExecutionStart = CONVERT(VARCHAR, GETDATE(), 107)

EXEC @IsBusinessDay  =  LiteIsWorkingDay @ExecutionStart

IF(@IsBusinessDay = 0)
BEGIN
    IF(CONVERT(VARCHAR,@InterMediateStartDate,108) >  CONVERT(VA开发者_StackOverflow社区RCHAR,GETDATE(),108))
    BEGIN   
        INSERT INTO TbJobQueue (JobId, ScheduleId, DueDate, Status, ExpiryDate, 
                                ProcessingDate, InputUser, InputTime, 
                                LastModifiedBy, LastModifiedTime)
        VALUES (@JobId, @ScheduleId,  @InterMediateStartDate,  'NQUE', NULL,
                NULL, 'Scheduler', GETDATE(), NULL, NULL)
    END
END

Please Help.

Thanks


If you want the value of the stored procedure in a variable you have to make something like this:

  1. Declare output parameter in the LiteIsWorkingDay stored procedure

    create procedure LiteIsWorkingDay @ExecutionStart varchar(20), @IsBusinessDay int output

  2. In LiteIsWorkingDay stored procedure you have to select a value for the @IsBusinessDay output parameter.

  3. In the stored procedure that calls LiteIsWorkingDay you need to do something like this to get its value:

    declare @ExecutionStart varchar(20) select @ExecutionStart = convert(varchar, getdate(), 107)

    declare @IsBusinessDay int exec LiteIsWorkingDay, @IsBusinessDay output

And that's all. Now the variable @IsBusinessDay will have the value that you want :)

0

精彩评论

暂无评论...
验证码 换一张
取 消