Monitor EXEC() statement

  • I'm trying to run an EXEC() statement against a linked server, and the query I'm running may or may not hang. I want to monitor it to see if it runs for more than 30 seconds, and if so, run some code, otherwise just run the statement and quit. Is that possible? It's something like:

    EXEC('UPDATE PERSON SET FIRSTNAME = ''Mike'' WHERE ID = 1') AT LINKEDSERVER

    Did this run for more than 30 secs? If yes, then

    <more T-SQL to send an email or update a table>

    else quit since it successfully ran the update statement.

    Does that make sense?

    Thanks,

    Mike

    Mike Scalise, PMP
    https://www.michaelscalise.com

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply