Click to open or copy the files for the XP_ODBC sample.
This is a sample extended stored procedure using 32-bit Visual C++ and the ODBC interface to open a new connection to the SQL Server that called the extended stored procedure. This extended stored procedure returns a result set and passes the results to the client. It uses a bound session for the loopback connection.
To connect to the server using integrated security, you must use the local server data source name (registered using ODBC in the Control Panel).
This sample uses the following keywords:
error; free; handle_odbc_err; malloc; message; printf; sprintf; sqlallocconnect; sqlallocenv; sqlallocstmt; sqlbindcol; sqlcolattributes; sqlconnect; sqldisconnect; sqlerror; sqlexecdirect; sqlfetch; sqlfreeconnect; sqlfreeenv; sqlfreestmt; sqlsetconnectoption; srv_describe; srv_getbindtoken; srv_impersonate_client; srv_paramdata; srv_paramlen; srv_paramtype; srv_pfield; srv_revert_to_self; srv_rpcparams; srv_senddone; srv_sendmsg; srv_sendrow; srv_setcoldata; srv_setcollen; strcmp; switch; xp_gettable