Home > Archive > Visual FoxPro SQL Queries > March 2006 > Stored proc error from a cursor within a cursor









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Stored proc error from a cursor within a cursor
new.microsoft.com

2006-03-13, 1:25 pm

Hello, I get the error :



"Cursorfetch: The number of variables declared in the INTO list must match
that of selected columns."



when I run the below cursor:



DECLARE TempCountCursor Cursor FOR

SELECT COUNT(*) as TotalCount

FROM v_job_costing_report


WHERE invoice_no = @invoice_no

OPEN TempCountCursor

BEGIN

FETCH NEXT FROM JobCostingCursor

INTO @temp_count

CLOSE TempCountCursor

DEALLOCATE TempCountCursor



It should return only one integer number so I do not understad why I get the
above error. This cursor is run within a cursor, I did not know if I can do
that and I wonder if that is the problem. I am new at SQL



Thanks for the help.


Cindy Winegarden

2006-03-13, 8:25 pm

Hi !

Are you working with Microsoft SQL Server? Are you working in Microsoft
Visual FoxPro at all? This newsgroup is for questions about working with
queries in Microsoft Visual FoxPro. If you're working with Microsoft SQL
Server you'll have better luck in a newsgroup with SQLServer in the name.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@msn
.com www.cindywinegarden.com


"new.microsoft.com" <cheneche@shaw,ca> wrote in message
news:uBsYqxsRGHA.1844@TK2MSFTNGP12.phx.gbl...
> Hello, I get the error :
>
>
>
> "Cursorfetch: The number of variables declared in the INTO list must match
> that of selected columns."
>
>
>
> when I run the below cursor:
>
>
>
> DECLARE TempCountCursor Cursor FOR
>
> SELECT COUNT(*) as TotalCount
>
> FROM v_job_costing_report

>
> WHERE invoice_no = @invoice_no
>
> OPEN TempCountCursor
>
> BEGIN
>
> FETCH NEXT FROM JobCostingCursor
>
> INTO @temp_count
>
> CLOSE TempCountCursor
>
> DEALLOCATE TempCountCursor
>
>
>
> It should return only one integer number so I do not understad why I get
> the above error. This cursor is run within a cursor, I did not know if I
> can do that and I wonder if that is the problem. I am new at SQL
>
>
>
> Thanks for the help.
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com