General information
Forum:
Microsoft SQL Server
Category:
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.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only