Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    11

    Unanswered: Error 16916: A cursor with the name "tentative_cursor" does not exist

    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
    -Sudhakar

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •