Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 2.59 KB

File metadata and controls

43 lines (30 loc) · 2.59 KB
title Executing Statements (ODBC)
description Executing Statements (ODBC)
author markingmyname
ms.author maghan
ms.date 03/14/2017
ms.service sql
ms.subservice native-client
ms.topic reference
helpviewer_keywords
SQL Server Native Client ODBC driver, statements
statements [ODBC]
ODBC applications, statements
statements [ODBC], executing

Executing Statements (ODBC)

[!INCLUDE SQL Server]

The [!INCLUDEssNoVersion] Native Client ODBC driver offers a variety ways to execute SQL statements in a [!INCLUDEssNoVersion] database:

  • Direct execution

  • Prepared execution

Direct execution involves building a character string containing a [!INCLUDEtsql] statement and submitting it for execution using the SQLExecDirect function. Prepared execution involves building a character string containing a [!INCLUDEtsql] statement and then executing it in two stages. The first stage uses the SQLPrepare Function function to parse and compile the execution plan for the statement in the [!INCLUDEssDE]. 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 [!INCLUDEtsql] statement or a batch of SQL statements, or they can call a stored procedure.

In This Section

See Also

Executing Queries (ODBC)