Hi,
I am creating a stored procedure which contains the declaration of a cursor, fetch the cursor, close the cursor, deallocate cursor. I tried executing this code in SQL analyzer and found working. But when I use the same code inside a create stored procedure, it throws the following error message.
Error 16916: A cursor with the name "tentative_cursor" does not exist
As a result, I am not able to proceed in creation of stored procedure with the above SQL statements.
Can any one help me where the problem is..
My SQL statements..
---
DECLARE tentative_cursor CURSOR
FOR select * from TbTentativeBookingTable where ExpTime < GETDATE()
GO
OPEN tentative_cursor
GO
DECLARE @.transactionno BIGINT
...
...
FETCH ...
CLOSE tentative_cursor
---
Thanks
-SudhakarThe GO keyword serves to terminate a SQL batch, so it implicitly ends a stored procedure declaration. There may be other problems too, but at the very least you need to remove the GO keyword(s).
-PatP
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment