Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 2.92 KB

File metadata and controls

48 lines (34 loc) · 2.92 KB
title Executing Statements (ODBC) | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.prod_service database-engine, sql-database, sql-data-warehouse, pdw
ms.reviewer
ms.technology native-client
ms.topic reference
helpviewer_keywords
SQL Server Native Client ODBC driver, statements
statements [ODBC]
ODBC applications, statements
statements [ODBC], executing
ms.assetid 063fc40d-ff81-490d-9c9b-2faefb729f37
author markingmyname
ms.author maghan
monikerRange >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

Executing Statements (ODBC)

[!INCLUDEappliesto-ss-asdb-asdw-pdw-md]

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)