0
votes
2answers
96 views

How to reduce the run time of stored procedure by getting rid of cursors?

I have a task of reducing the run time of a stored procedure that runs for hours. Description of task: The cursor takes a set of values @Master and @Slave obtained from a query(5000+ rows), finds ...
0
votes
1answer
35 views

Nested cursors, multiple result sets

I'm using a SQL Server stored procedure to generate an Excel report. Basically each "entry" in the report has three parts: Object, Observation, and Points. The observations have a reference to the ...
1
vote
0answers
76 views

SQL SERVER 2008 Cursor Problem

I have a table that has some missing values for certain transactions. The value for a particular transaction is going to depend on the value of all preceding transactions. Because the preceding ...
-1
votes
1answer
534 views

how cursor implementations are different for each cursor type in sql server

In Oracle, there are only 2 types of cursor i.e. Implicit and Explicit cursor. Which is easy to understand. But, in SQL Server there are 4 Cursor AFAIK i.e. Static,Dynamic,Forward Only and Scroll. ...
2
votes
1answer
169 views

Internal architecture of cursors

I know that cursor isn't very good idea, but I have some questions for internal structure of cursor. First step in cursor is determining result set which cursor iterate over. So, did cursor execute ...
2
votes
2answers
100 views

Performing a “Spread Negitive” over a dataset

I have a situation where a table that represents outstanding balances and credits are both contained in one table. What I need to do is apply all outstanding credits (preferably in order of oldest ...
3
votes
1answer
349 views

Optimization around static cursor use

I'm currently in-house support for a vendor-supplied application which uses static cursors to crawl through a list of data. I've leaned on the vendor as much as I can to fix their cursor use with no ...
1
vote
1answer
778 views

Cursor doesn't print text when I tell it to

I have used WAITFOR combined with a cursor in the following script: create table orders(orderId int primary key,productId int,productName varchar(20)); insert into orders values(1,11,'book'); insert ...
7
votes
3answers
307 views

When are procedural queries absolutely necessary?

I know that we tend to avoid cursors and loops within SQL Server at every cost, but what are some of the situations where you absolutely need procedural queries, and set-based queries just will not ...