• I see what you mean - for that there is a small change required in the script, need to bring up the error generating statement in Loop where Steps are created. I am new to this website, not sure how to edit original script that I posted. If you know that, please let me know so that I can update the original script.

    Else -

    In the original script

    bring Line #172 : ???PRINT 'IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback'

    Before Line #169: ????????????SELECT @LoopControl = @LoopControl + 1

    i.e. the code should be like:

    ----------------------Code Snippet To Be-----------------------------

    ????????????PRINT '????????@database_name=N''' + @database_name + ''','

    ????????????PRINT '????????@flags=' + CAST(@flags as varchar(30))

    ????????????PRINT ''

    ????PRINT 'IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback'

    ????????????SELECT @LoopControl = @LoopControl + 1

    ????????END -- End Steps While

    ????PRINT ''

    ????PRINT 'EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1'

    ????PRINT 'IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback'

    ????

    ????PRINT ''

    ????

    ????--CREATE SCHEDULES