BEGIN
Drop table #TEMP_STAGES_STAGES
Declare @P_STAGE_ID Varchar(20)
SET ROWCOUNT 0
SELECT STAGE_ID ,STAGE_NAME into #TEMP_STAGES FROM dbo.WORK_FLOWS_LOAD_CURRENT_STAGES_BY_ORDER_FUNCTION(3, 1, 2);
SET ROWCOUNT 1
Select @P_STAGE_ID = STAGE_ID from #TEMP_STAGES
While @@rowcount <> 0
Begin
select * from MEDICAL_REPORTS_APPROVAL_STAGES Where REQUEST_STAGE_ID = @P_STAGE_ID
PRINT(@P_STAGE_ID);
Delete from #TEMP_STAGES where STAGE_ID = @P_STAGE_ID
Select @P_STAGE_ID = STAGE_ID from #TEMP_STAGES
End
Set Rowcount 0
Drop table #TEMP_STAGES
END
Drop table #TEMP_STAGES_STAGES
Declare @P_STAGE_ID Varchar(20)
SET ROWCOUNT 0
SELECT STAGE_ID ,STAGE_NAME into #TEMP_STAGES FROM dbo.WORK_FLOWS_LOAD_CURRENT_STAGES_BY_ORDER_FUNCTION(3, 1, 2);
SET ROWCOUNT 1
Select @P_STAGE_ID = STAGE_ID from #TEMP_STAGES
While @@rowcount <> 0
Begin
select * from MEDICAL_REPORTS_APPROVAL_STAGES Where REQUEST_STAGE_ID = @P_STAGE_ID
PRINT(@P_STAGE_ID);
Delete from #TEMP_STAGES where STAGE_ID = @P_STAGE_ID
Select @P_STAGE_ID = STAGE_ID from #TEMP_STAGES
End
Set Rowcount 0
Drop table #TEMP_STAGES
END
No comments:
Post a Comment