Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    8

    Unanswered: URGENT - SQL Server replication failing

    SQL server replication is failing with the following error

    "A cursor with the name 'CompanyCursor' already exists"

    How do I deallocate this cursor so that replication stays up?
    Any suggestions will be much appreaciated.
    --------------------------------------------------------------------------------
    It is using stored proc replication and seems to have a sp with a cursor that is left without deallocating it.

    When the stored procedure is called more than once on the publisher side, it tries to repeat the same in a single session on the subscriber end, it finds the cursor already there. ??

    How do I deallocate the cursor so replication can start up? Is there a global setting that I can check to find outstanding cursors? Or do I need to remove the subscription and recreate it?

    I am using sql server 2000, service pack 2. Transactional replication is used and the log does not provide me with any more info.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    The following is an example from bol:

    USE pubs
    GO

    DECLARE authorcursor CURSOR FOR
    SELECT au_fname, au_lname
    FROM authors
    ORDER BY au_fname, au_lname

    OPEN authorcursor
    FETCH NEXT FROM authorcursor
    WHILE @@FETCH_STATUS = 0
    BEGIN
    FETCH NEXT FROM authorcursor
    END

    CLOSE authorcursor
    DEALLOCATE authorcursor
    GO

Posting Permissions

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