MS Sql Server 6.0 Stored Procedures 
Author Message
 MS Sql Server 6.0 Stored Procedures

I have a stored procedure that contain a cursor that is declared
scrollable. I read the first entry in this cursor to get a value. Then I
read the last entry to get a different value. These values are then used
to calculate the difference.

The problem is that the first time after I have compiled the SP every
works fine. As soon as I run this again, I get screwy results. It seems as

is not 0). All I have to do is to recomplie the SP for it to work correct
the first time, but again not after that.

Is this a feature (read BUG) or am I doing something STUPID?

Thanks
JHS



Sun, 27 Dec 1998 03:00:00 GMT  
 MS Sql Server 6.0 Stored Procedures

Here are some things to check:

1) Ensure that the number of variables declared in the FETCH
FIRST INTO statement matches exactly (both in number and in
datatype) with the number returned by the CURSOR SELECT
statement.

2) Do the same for the FETCH LAST statement (I have severe
problems when I forget to put the variables on another FETCH
statement in the procedure).

3) Ensure that if you are not reusing the same cursor that you
DEALLOCATE it at the end of the stored procedure.

Good luck...

Quote:

> I have a stored procedure that contain a cursor that is declared
> scrollable. I read the first entry in this cursor to get a value. Then I
> read the last entry to get a different value. These values are then used
> to calculate the difference.

> The problem is that the first time after I have compiled the SP every
> works fine. As soon as I run this again, I get screwy results. It seems as

> is not 0). All I have to do is to recomplie the SP for it to work correct
> the first time, but again not after that.

> Is this a feature (read BUG) or am I doing something STUPID?

> Thanks
> JHS


--
Karl Costenbader, President
Competent Consulting
Sacramento, CA

Home Page: http://www.competent.com


Mon, 28 Dec 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MS SQL Server 6.0 stored procedures

2. Pass parameter to a MS SQL stored procedure from Crystal Report 6.0

3. VB4 RDO Won't detect an error in an SQL Server 6.0 stored procedure

4. executing stored procedures from VB3.0/SQL Server 6.0

5. HELP! CreatePreparedStatement and SQL Server 6.0 stored procedure

6. HELP! CreatePreparedStatement and SQL Server 6.0 stored procedure

7. Calling a SQL Server 2000 store procedure from MS-Access

8. MS SQL Server BLOBS, RDO and Stored Procedures

9. MS SQL Server Stored Procedures

10. doing updating from grid to sql server with stored procedure sql 2000

11. Executing MS SQL Server 2000 stored procs via MS Access 2000

12. VB6 and stored procedures using SQL 6.0

 

 
Powered by phpBB® Forum Software