Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9169099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:47:31+00:00 2026-06-17T15:47:31+00:00

I’m trying to programmatically run some SSRS subscriptions one after the other. The reports

  • 0

I’m trying to programmatically run some SSRS subscriptions one after the other. The reports are all long running and consistently fail if triggered at the same time. At the moment we have about four different subscriptions spread out through the day ensuring that they don’t clash. Unfortunately this can waste quite a lot of time.

The solution I have for this is to create a subscription that is not scheduled to run on all each of the reports in question and then get one job to trigger each subscription one after the other once each has finished running:

  1. One job triggers the first subscription
  2. Using a WAITFOR command give a few seconds for the subscription to run.
  3. Using WAITFOR command check periodically that the subscription is running (‘Pending’)
  4. When the WAITFOR check finds that the report has been sent the job triggers the next subscription
    and so on….

I know the code to trigger the subscription:

exec [ReportServerWSS].dbo.AddEvent @EventType='SharedSchedule', @EventData='011e83ff-344a-416a-83cb-1a9281e4205b'

I just need to know how to use the WAITFOR whilst doing a check and then respond to the results of the check.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:47:33+00:00Added an answer on June 17, 2026 at 3:47 pm

    OK – I’ve figured this out:

    DECLARE @SubscriptionStatus AS nvarchar(260)
    
    
    EXEC msdb.dbo.sp_start_job '4B7FA89E-0B56-4ED1-9A0F-37E5D03318CB' /*First long running    report*/
    WAITFOR DELAY '00:00:30'
    
    SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where subscriptionid =    'E156FD91-E7F9-43EC-8B73-28622834EACB')
    
    
    CheckSubscription1:
        IF @SubscriptionStatus = 'Pending'
        BEGIN
            PRINT 'The First long running Subscription is still running'
            WAITFOR DELAY '00:01:00'
            SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where     subscriptionid = 'E156FD91-E7F9-43EC-8B73-28622834EACB')
        END
    
    IF @SubscriptionStatus = 'Pending'
        GOTO CheckSubscription1
    
    ELSE
    
    EXEC msdb.dbo.sp_start_job '6D3300BC-ACA9-4EEE-A5F9-546635B585E0' /*Second long running    report*/
    WAITFOR DELAY '00:00:30'
    
    SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where subscriptionid =        'AD54215A-5B7F-48B2-81B2-52C299875AD6')
    
    CheckSubscription2:
        IF @SubscriptionStatus = 'Pending'
        BEGIN
            PRINT 'The second long running Subscription is still running'
            WAITFOR DELAY '00:01:00'
            SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where     subscriptionid = 'AD54215A-5B7F-48B2-81B2-52C299875AD6')
        END
    
    IF @SubscriptionStatus = 'Pending'
        GOTO CheckSubscription2
    
    ELSE
    
    EXEC msdb.dbo.sp_start_job '84FD876A-1945-405E-A344-6279E27DCD68' /*Third long running     report*/
    
    WAITFOR DELAY '00:00:30'
    
    SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where subscriptionid =    '8F446935-5450-458F-9076-7AD9FC78D456')
    
    CheckSubscription3:
        IF @SubscriptionStatus = 'Pending'
        BEGIN
            PRINT 'The third long running Subscription is still running'
            WAITFOR DELAY '00:01:00'
            SET @SubscriptionStatus = (SELECT LastStatus FROM Subscriptions Where    subscriptionid = '8F446935-5450-458F-9076-7AD9FC78D456')
        END
    
    IF @SubscriptionStatus = 'Pending'
        GOTO CheckSubscription3
    
    ELSE
    
    PRINT 'All long running report run'
    

    Thanks,
    UT

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking to have one of my Windows Forms applications be run programmatically—from
I'm trying to compile Scala files programmatically by using an instance of Global.Run :
I am trying to build datalog queries programmatically, but keep running into the problem
I'm trying to programmatically change the IP of a website running on Server 2003.
im having some wierd issue with my GridView. Basically, im trying to run a
I've run into a problem trying to programmatically apply a Silverlight Toolkit Theme. An
I am trying to integrate some new code I wrote for programmatically interacting with
I'm trying to determine the asymptotic run-time of one of my algorithms, which uses
I'm trying to programmatically insert a dijit.form.Button into some HTML and my code goes
Trying to programmatically add options to a SELECT drop down in IE Windows Mobile.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.