Assign value in integer returned from stored procedure + Sybase
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:
Declare output parameter in the LiteIsWorkingDay stored procedure
create procedure LiteIsWorkingDay @ExecutionStart varchar(20), @IsBusinessDay int output
In LiteIsWorkingDay stored procedure you have to select a value for the @IsBusinessDay output parameter.
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 :)
精彩评论