Condividi tramite


Accessing Server Stored Procedures 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 server-stored procedures, see your server documentation.

See Also

Using SQL Pass-Through Technology | Returning Multiple Result Sets | Implementing a Client/Server Application | Designing Client/Server Applications | Upsizing Visual FoxPro Databases | Creating Views