jeudi 15 septembre 2016

stored procedure within stored procedure

create  procedure  spGoti

@WeekNumber nvarchar(255)
as
begin


execute spPointsUpdate @WeekNumber

execute spGivebadges @WeekNumber

execute spLevelField @WeekNumber
execute spAddNewWeekDataToTotalOfEmployeeTable @WeekNumber

execute spTop15Overall
execute spWeeklytop15 @WeekNumber

end

in the above code i have written stored procedures within stored procedures. I have a peculiar problem here.the second stored procedure here "spGivebadges @WeekNumber" uses the output of previous stored procedure "spPointsUpdate @WeekNumber" here.

The problem is if i execute the parent stored procedure i.e "spGoti" the second stored procedure "spGivebadges @WeekNumber" doesnot get executed .But when i RUN THE PARENT STORED PROCEDURE i.e "spGoti" THE SECOND TIME THE SECOND STORED PROC GETS EXECUTED WITHOUT ANY PROBLEM.

All the other stored procedures within the parent gets executed the first time itself,though some are using output of another.

wHY IS THIS HAPPENING ? ANYONE FACED SOMETHING SIMILAR BEFORE OR ANY SOLUTION YOU CAN THINK OF ? THANKS

Aucun commentaire:

Enregistrer un commentaire