gmanouvrier
Programmer
Hi,
I have a stored pocédure which open a cursor and incremente a variable according to certain criteria. Then, I would have liked that my stored procedure turns over the value. However, I noticed that the execution of the sotckée procedure were made way asynchrone.Aussi, no value is not turned over because the stored procedure leaves before providing me the result. How could I make synchronous the éxecution of my procedure?
For example this procédure return 0 instead of returning 500 :
CREATE PROCEDURE GetTransfertCount
@id_t int, @@transferts int output
AS
set @@transferts=500
DECLARE story CURSOR FOR
SELECT * FROM history_ticket WHERE id_ticket=@id_t
declare @cpt int
OPEN story
FETCH NEXT FROM story
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM story
--my real code with real incrementation
END
CLOSE story
DEALLOCATE story
return @@transferts
I have a stored pocédure which open a cursor and incremente a variable according to certain criteria. Then, I would have liked that my stored procedure turns over the value. However, I noticed that the execution of the sotckée procedure were made way asynchrone.Aussi, no value is not turned over because the stored procedure leaves before providing me the result. How could I make synchronous the éxecution of my procedure?
For example this procédure return 0 instead of returning 500 :
CREATE PROCEDURE GetTransfertCount
@id_t int, @@transferts int output
AS
set @@transferts=500
DECLARE story CURSOR FOR
SELECT * FROM history_ticket WHERE id_ticket=@id_t
declare @cpt int
OPEN story
FETCH NEXT FROM story
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM story
--my real code with real incrementation
END
CLOSE story
DEALLOCATE story
return @@transferts