Executing Statements (ODBC)

The SQL Native Client ODBC driver offers a variety ways to execute SQL statements in a SQL Server database:

  • Direct execution
  • Prepared execution

Direct execution involves building a character string containing a Transact-SQL statement and submitting it for execution using the SQLExecDirect function. Prepared execution involves building a character string containing a Transact-SQL statement and then executing it in two stages. The first stage uses the SQLPrepare function to parse and compile the execution plan for the statement in the 데이터베이스 엔진. The second stage uses the SQLExecute function to execute the previously prepared execution plan. This saves the parsing and compiling overhead on each execution. Prepared execution is commonly used by applications to repeatedly execute the same, parameterized SQL statement.

Both direct and prepared execution can execute a single Transact-SQL statement or a batch of SQL statements, or they can call a stored procedure.

참고 항목

개념

Executing Queries (ODBC)

도움말 및 정보

SQL Server 2005 지원 받기