Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return single value with SQL Pass Through
Message
From
11/06/2001 04:43:08
 
 
To
11/06/2001 03:42:23
Martin Van Krieken
Capgemini Nederland Bv
Utrecht, Netherlands
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00517648
Message ID:
00517654
Views:
11
Martin,
The result of a stored procedure is returned as a cursor to VFP. Example:
*-- call a SPROC
SQLEXEC(nSql, "EXEC sp_dboption 'northwind', 'select into/bulkcopy'")
*-- query the result set. In this case, sqlResult only contains one record
?sqlResult.currentSetting && returns "ON" or "OFF"
*-- the following SPROC returns info about the primary key
?SQLEXEC(nSql, "EXEC sp_pkeys 'order details'", "PKEYS")
BROWSE && returns 2 rows
Another way to return a value from a SPROC is to define an OUTPUT parameter in the SPROC and pass the parameter by reference:
lcRetVal = "" && initialize return value
*-- create a stored procedure that uses an OUTPUT parameter
SQLEXEC(nSql, "create procedure sp_test @cRetVal char(100) OUTPUT AS SELECT @cRetVal = 'This is a return value'")
?SQLEXEC(nSql, "EXEC sp_test ?@lcRetVal")
?lcRetVal
HTH
>Hello,
>
>I want to call a stored procedure in a SQL server database , which returns a single value. I use SPT to access the database, but I can't find a way to retrieve the return value. Am I missing something or is this just impossible?
>
>TIA,
>
>Martin
Daniel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform