Using Result Sets
When you use the SQL pass-through functions SQLEXEC( ) or SQLMORERESULTS( ) to query data, Visual FoxPro returns the data to you in one or many result sets. Result sets originate from cursors in the server data source and become cursors in Visual FoxPro. The default name for a result set is SQLRESULT.
How the Server Processes Result Sets and Errors
Because the server compiles each stored procedure when you create it, you receive any server syntax errors at create time. When you execute the stored procedure, the server executes the compiled SQL statements sequentially (as in a Visual FoxPro program) and Visual FoxPro fetches each result set from each SQL statement within the stored procedure separately, in the order executed.
Result sets and errors are returned in the order received, and processing stops if an error is encountered. For example, if a run-time error occurs when the server executes the third statement in a four-statement stored procedure, you receive the first two result sets and then receive the error that occurred upon processing the third result set. Processing stops after the error is returned; the fourth result set is not retrieved. You can use the AERROR( ) function to obtain information about the most recent error.
Note
You can execute stored procedures on a remote server from Visual FoxPro only by using Visual FoxPro SQL pass-through functions. Views don't support stored procedures on a remote server, because each view contains an explicit SQL SELECT statement in its SQL definition.
See Also
Tasks
How to: Use SQL Pass-Through Functions
How to: Access Stored Procedures on Remote Servers with SQL Pass-Through Functions
How to: Return Multiple Result Sets
Concepts
Processing Multiple Result Sets
Other Resources
Using SQL Pass-Through Technology
Enhancing Applications Using SQL Pass-Through Technology
Planning Client/Server Applications