
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