Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Thanks Sergey,
This is what I have now in the stored procedure:
CREATE PROCEDURE ACC_usp_Next_Number @cTableName char(40),@cKey AS CHAR(40),@iNext int OUTPUT AS
DECLARE @ret_ext_max nvarchar(100), @cSQLString nvarchar(100)
SET @cSQLString = N'SELECT @ret_ext_max = MAX('+@cKey+') FROM '+RTRIM(@cTableName)
EXEC sp_executesql @cSQLString, N'@ret_ext_max nvarchar(100) OUTPUT',
@ret_ext_max OUTPUT
SET @iNext = @ret_ext_max
PRINT @iNext
------------------------------------------------------------
*-- When I run it from the query analyser it prints the right number, BUT when I called it from Foxpro the return parameter stays the same. This is the way I call it from Foxpro:
LOCAL lnExecutionSuccess,lcString,lnLastNumber
lnLastNumber = 0
lcString = "{CALL ACC_usp_Next_Number ('ACC_NOC','iNOC_id',?@lnLastNumber)}"
lnExecutionSuccess = SQLExec(oApp.nConnectionHandle,lcString)
*-- Basically lnLastNumber always stays as 0
Do you know why this is happening?
Thanks.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement