I have a development environment that talks to MSSQL through a 3rd party driver. The driver appears to be setting up a cursor and then 'Fetching' against that cursor. My problem is that I see these in the activity monitor but have no way of identifying the TSQL code that set up the cursor so I don't know from whence it came nor am I able to optimize that code (because I can't find it.) It appears in the Activity Monitor Recent Expensive Queries like so:
Can anyone give me a way of finding the SQL code that set up the cursor or what table(s) the cursor is accessing?
Code:
FETCH API_CURSOR000000000000002A