Kamil,
By any chance, do you've SET CURSOR_CLOSE_ON_COMMIT set to ON? You can use
sp_dboption system stored procedure to check that.
>Hello All
>I have two procedures which communicate via a cursor.
>I did by the book (Help sample), but i get the following error.
>Server: Msg 16950, Level 16, State 2, Procedure PlaceByDep, Line 8
>The variable '@PkList' does not currently have a cursor allocated to it.
>
>Below are the procedures
>CREATE PROCEDURE PlaceByDep @PK UniqueIdentifier
>AS
>Set NoCount ON
>DECLARE @PkList CURSOR
>EXEC DeepPk @PK, 'DepPkNodeList', @PkList OUTPUT
>create table #PkList (PK uniqueidentifier)
>
>FETCH NEXT FROM @PkList into @Pk
>WHILE (@@FETCH_STATUS = 0)
>BEGIN
> Insert Into #PkList (PK) Values (@PK)
> FETCH NEXT FROM @PkList into @Pk
>END
>CLOSE @PkList
>DEALLOCATE @PkList
>select * from #PkList
>return
>GO
>
>
>CREATE PROCEDURE [DeepPk] @ParentPK uniqueidentifier
> , @NodProc_Na char(64)
> , @PkCursor CURSOR VARYING OUTPUT
>
>AS
>create table #PkList (PK uniqueidentifier)
>Insert into #PkList (Pk) Values (@ParentPK)
>execute @NodProc_Na @ParentPk
>
>Set @PkCursor= Cursor Local Fast_Forward
> For Select * from #PkList
>
>Open @PkCursor
>
>return
>GO
>
>
>Thank you.
>Kamil
--sb--