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.
"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.