exec sp_cursorfetch

  • Hi there,

    I'm running the sql profiler tool on our server and this statement keeps showing up with different parameters:

    exec sp_cursorfetch 180150015, 2, 0, 1

    Can anybody give me a clue as to what it does and how often is it appropriate for it to be executed?

    Thanks

    -jr

  • The sp_cursorfetch call is being made by your client machine's database API (e.g. ADO or ODBC) to retrieve data from SQL Server.

    The way the API is doing this is to create a cursor on the Server containing the data required. Sp_cursorfetch is then being used automatically to retrieve then next batch of rows.

    You should be seeing calls to sp_cursoropen etc etc as well.

  • When you create a recordset(eg., ado) with server side cursor option and cursor type other than static, you will get sp_cursorfetch in trace.

    The sp_cursorfetch is called for each time you execute a move next in the recordset.

    Hence the number of times this will be executed will be equal to number of times you do a movenext operation in recordset.

    However what matters in trace is not how frequently this is executing, instead how much time each move next is taking.

    If the time column trace is showing approximately 0 values then nothing to worry.

    Instead if each call to sp_cursorfetch is taking time 30 50 100 ms then it may be due to query is too complex or Query is not optimized. In this case you need to look into the sql and optimize it using introducing index etc.,

    Hope this helps

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

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