How to: Access Stored Procedures on Remote Servers with SQL Pass-Through Functions
You can use Visual FoxPro SQL pass-through technology to create and execute stored procedures on a remote server. Stored procedures can greatly enhance the power, efficiency, and flexibility of SQL, and dramatically improve the performance of SQL statements and batches. Many servers provide stored procedures for defining and manipulating server database objects and for performing server system and user administration.
Note
The examples in this section use Microsoft SQL Server syntax unless otherwise noted.
To call a server stored procedure
- Use the SQLEXEC( ) Function with the stored procedure name.
For example, the following code displays the results of calling a stored procedure named sp_who on SQL Server using an active connection to the data source sqlremote:
nConnectionHandle = SQLCONNECT('sqlremote')
? SQLEXEC(nConnectionHandle, 'use pubs')
? SQLEXEC(nConnectionHandle, 'sp_who')
BROWSE
For more information on creating and executing stored procedures on a remote server, see your server documentation.
See Also
Tasks
How to: Return Multiple Result Sets
Other Resources
Using SQL Pass-Through Technology
Enhancing Applications Using SQL Pass-Through Technology
Planning Client/Server Applications