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 6239355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:22:47+00:00 2026-05-24T11:22:47+00:00

http://msdn.microsoft.com/en-us/library/ms190346.aspx It says here in the section under the statement start/end offset that you

  • 0

http://msdn.microsoft.com/en-us/library/ms190346.aspx

It says here in the section under the statement start/end offset that you can use that in conjunction with dm_exec_sql_text to get the currently executing cursor statement. What would be the command for that?

I have a fairly large SP that froze when it reached a cursor logic loop ‘while (@@fetch_status =0) and I’d like to see if it is the exact executing statement I think it is, and I’d also like to see the parameters for this statement so I can see exactly why the cursor either never exited, or just why the statement inside the loop won’t complete. Thanks!

  • 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-05-24T11:22:47+00:00Added an answer on May 24, 2026 at 11:22 am

    start with this

    SELECT * FROM(SELECT session_id,
         COALESCE(OBJECT_NAME(s2.objectid),'Ad-Hoc') AS ProcName,
        (SELECT TOP 1 SUBSTRING(s2.TEXT,statement_start_offset / 2+1 ,
          ( (CASE WHEN statement_end_offset = -1
             THEN (LEN(CONVERT(NVARCHAR(MAX),s2.TEXT)) * 2)
             ELSE statement_end_offset END)  - statement_start_offset) / 2+1))  
           AS sql_statement
    FROM sys.dm_exec_requests AS s1
    CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s2 ) x
    WHERE  sql_statement 
    NOT like 'SELECT * FROM(SELECT session_id,COALESCE(%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://msdn.microsoft.com/en-us/library/system.windows.controls.listboxitem.aspx Says ListBoxItem is in System.Windows.Controls. Where is that namespace? The using Windows.System.Controls; statement
http://msdn.microsoft.com/en-us/library/system.object.gethashcode(VS.80).aspx says: For the best performance, a hash function must generate a random distribution
The MSDN CreatMutex() documentation ( http://msdn.microsoft.com/en-us/library/ms682411%28VS.85%29.aspx ) contains the following remark near the end:
MSDN says http://msdn.microsoft.com/en-us/library/ms256086.aspx degree[@from != Harvard] - All elements where the from attribute is
It is said here: http://msdn.microsoft.com/en-us/library/aa211599%28v=office.11%29.aspx Before the procedure will run, you must connect the
References http://msdn.microsoft.com/en-us/library/6tc47t75%28v=VS.80%29.aspx http://msdn.microsoft.com/en-us/library/ms366730.aspx Question In the 2nd link precisely under heading Create a Custom
This link http://msdn.microsoft.com/en-us/library/aa772153(VS.85).aspx says: You can register up to five notification requests on a
According to : http://msdn.microsoft.com/en-us/library/ms175061.aspx It says that the NOT LIKE relational operator : Specifies
http://msdn.microsoft.com/en-us/library/ms731379.aspx says value of maxConcurrentSessions is by default 10 where as http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicethrottlingbehavior.maxconcurrentsessions.aspx says its
The MSDN documentation (http://msdn.microsoft.com/en-us/library/bb174425%28v=vs.85%29.aspx) says that Direct3D 9 applications can expect messages to be

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.