Solved

sp_addextendedproc usage

Posted on 1998-09-29
4
579 Views
Last Modified: 2008-03-04
While using SQL Trace on an application, I noticed the following code:
sp_cursorfetch 95226679,2,0,1

sp_cursorfetch is defined as follows:
exec sp_addextendedproc 'sp_cursorfetch','(server internal)'

Could someone explain what is happening here?
0
Comment
Question by:vd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:vd
ID: 1090326
Adjusted points to 70
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1090327
There are two ways ODBC driver can 'request' data from SQL server can send data to your application - either by executing straight select and sending all the data at once -in this case you will see 'SELECT....' statement.
In the secon case it builds cursor on the server side and uses sp_cursorfetch to fetch data in chunks.
0
 

Author Comment

by:vd
ID: 1090328
What would be the reason to use this method? Also, what
are the parameters being used, such as 952266979 ?
0
 
LVL 2

Accepted Solution

by:
martyn_bannister earned 70 total points
ID: 1090329
vd,

sp_cursorfetch appears to be a compiled system stored procedure, written by the boys and girls at Microsoft.

As such, we can't work out what parameters it takes, although I would hazard a guess that 952266979 is an id (probably of the cursor itself).

A cursor will naturally be used when MS-SQL Server is building a result set in answer to a SELECT statement. It is essentially the area of memory on the server where the rows are stored before being sent to the client. The sp_cursorfetch is the procedure that sends each row.

Instead of writing a simple SELECT statement on the client, it is also possible to directly create and fetch rows from a CURSOR. This is normally done when you want to act on each row coming back from the database individually, rather than receive them as a block of rows which can only be processed after the last one has arrived. This situation normally arises when what you want to do something horrendously complicated with each row, but don't want to store them in a temporary table and work from that.

See "DECLARE CURSOR" in Transact SQL help for further details.
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question