Command to Stop Query Batch

  • Can any one of you help me getting the query/command to stop the execution of a stored procedure?

    I tried in the following way:

    1. I created a stored procedure in a database

    2. Opened the SQL Profiler and cleared the statements

    3. executed the sp and then stopped it using the stop option available in SSMS.

    4. When I saw the profiler, I didn't get any query performed to stop the batch.

    Can any one of you help me in getting the query/command to stop the execution of a stored procedure.

  • When you hit 'cancel query' or 'stop' in SSMS, it sends an out-of-band data packet which is recognized as an Attention by the server. You can see Attention events via Profiler.

    Why on earth might this information be useful to you?

  • I was asked this question in the interview of Microsoft..

    So i was looking out the answer...

  • Odd question to be asked, but that's the answer:

    The Profiler event is Attention - you'll find it in the Errors and Warnings event group.

    There is no query - it's a special data packet.

Viewing 4 posts - 1 through 3 (of 3 total)

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