Fetch with a pause

Posted on 2011-10-31
Last Modified: 2012-05-12
I have a fetch statement that on each id in the fetch it executes a stored procedure

Start Fetch...
exec spMine @id
next Fetch

Is there a way to put a pause (say 10 seconds) on each exec statement.
Question by:lrbrister
    LVL 75

    Accepted Solution

    I have no idea what you are doing, but this should give you the pause you need:
    WAITFOR DELAY '0:00:10'

    Author Comment

    In all my years I've never had a request so asinine from management

    We use MS Exchange Server
    I need to get "contacted by customer" emails to the Sales Reps in as fair a way as possible.
    So...I have

     select salesRepEmail from repemails order by newid()  
    This is done so that everyone has a chance to be first

    4 of the reps get their emails much slower than the other 120 reps.  as much as 10 seconds all things being equal...


    I've been tasked to send them out with a delay of "x" seconds in between.

    Either that or I need to find a way to send the Death Star to their cubicle.
    LVL 7

    Expert Comment

    I am not sure whether introducing the delay in the select statement will get you there since the problem of the delay the 4 sales reps are receiving data at wouldnt be corrected - everyone else will still get the data earlier. How about solving the delay issues for the 4 (which I assume are remote vs the others being local) 10 second delays seem excessive at this time.

    Author Comment

    Yeah...I know.  However...we have a Network team that handles the Exchange server and I can't solve this myself.

    The otehrs are not remote...they're sitting in the same open office with the other 120

    It's not the POP3 Send/Receive because Exchange is pushing this out automatically.

    That's it...sending the Death Star.
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    >4 of the reps get their emails much slower than the other 120 reps.
    the problem is surely with their email system settings config ...
    which should be solved by either the exchange server or the ms outlook (presuming that client is used) team, not be sql backend.

    anyhow, I don't see the point in sending 1 customer contact by email to all 124 reps ... it should be send to a couple of them, and if none of them answers/handles the request in a timely manner, send the mail to 10 more etc ... with escalation etc ...

    Author Comment

    I agree completly.
    But this is a sales issue and the email contains a "Click Event"

    The owner wants this to be a "eary bird..." situation.

    Trying to get them to see the light.

    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    well, as said, the WAITFOR DELAY seems appropriate, but still, the 10 second delays won't really solve the issue, because those 4 will still have delays.
    this said: it's those 4 that should have most interest in getting this solved, and getting it solved by the right team ...

    Author Closing Comment

    Sorry for the delay in getting back.

    I hate having to do this....just for a few email accounts but it is what it is.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now