Поделиться через


How to: Call Stored Procedures (ODBC)

Добавления: 14 апреля 2006 г.

When a SQL statement calls a stored procedure using the ODBC CALL escape clause, the Microsoft® SQL Server™ driver sends the procedure to SQL Server using the remote stored procedure call (RPC) mechanism. RPC requests bypass much of the statement parsing and parameter processing in SQL Server and are faster than using the Transact-SQL EXECUTE statement.

To run a procedure as an RPC

  1. Construct a SQL statement that uses the ODBC CALL escape sequence. The statement uses parameter markers for each input, input/output, and output parameter, and for the procedure return value (if any):

    {? = CALL procname (?,?)}
    
  2. Call SQLBindParameter for each input, input/output, and output parameter, and for the procedure return value (if any).

  3. Execute the statement with SQLExecDirect.

ms403294.note(ru-ru,SQL.90).gifПримечание.
If an application submits a procedure using the Transact-SQL EXECUTE syntax (as opposed to the ODBC CALL escape sequence), the SQL Server ODBC driver passes the procedure call to SQL Server as a SQL statement rather than as an RPC. Also, output parameters are not returned if the Transact-SQL EXECUTE statement is used.

См. также

Основные понятия

Batching Stored Procedure Calls
Running Stored Procedures
Calling a Stored Procedure
Procedures

Другие ресурсы

Running Stored Procedures (ODBC)

Справка и поддержка

Получение помощи по SQL Server 2005