Hi Sergey,
Thanks for the tip. It *almost* works. The proc executes ok but the return value is odd. Below is what I ran and the results.
A possible problem is that I'm running this against Sybase 12.5 instead of MS SQL Server and I've found Sybase to be a little flaky sometimes. I'll run this against MS SQL Server as soon as I can. Thanks again.
Gary
*-- VFP Code
LOCAL nRetVal
LOCAL cName
nRetVal = 0
? SQLEXEC(nConnection,[{?@nRetVal=call test1 ?cName}]) && Returns 1
? nRetVal && Returns 3.92438E-308
*-- Stripped down version of the proc and call
? SQLEXEC(nConnection,[{?@nRetVal=call test2}]) && Returns 1
? nRetVal && Returns 4.06272E-308
***********************************
CREATE PROCEDURE test1
@cName CHAR (8)
AS
BEGIN
if @cName = 'Gary'
return 123
else
return 321
END
**********************************
CREATE PROCEDURE test2
AS
return 123
>Gary,
>
>This shoud work for you.
lnRetval = 0
>lnResult = SQLEXEC(nConnection,[{?@lnRetval=call MyProc}])
>
>>Hi,
>>Does anyone know how to get a return value from a SQL Server stored proc? For example, if I have a line of code "RETURN 123" in the proc, how do I receive that? The proc doesn't take an output parameter, just returns a number.
>>
>>? SQLEXEC(nConnection,[exec MyProc]) && Returns a 1 showing that the call didn't have an error
>>
>>Thanks.
>>