Applications accessing Microsoft® SQL Server™ databases through a database API must move data between application variables and:
Applications must move data from the columns of a fetched row in a result set into application variables.
Applications must move data from a stored procedure return code into an application variable.
Applications must move data between stored procedure parameters and application variables. Parameters can be input or output parameters, so data movement can either be from the variable to the parameter, or from the parameter to the variable.
ODBC and OLE DB parameter markers are used in SQL statements in place of either input expressions (such as in a WHERE clause search condition) or stored procedure parameters and return codes. Applications must move data from application variables and the expression replaced by the parameter marker. For more information, see Parameter Markers.
Many database APIs use the concept of binding to specify how the data is to be moved between an application variable and the SQL Server object. Database APIs provide functions that an application can call to:
Data movement typically occurs:
The bound application variables are not required to have the same data type as the SQL Server object to which they are bound. If the data types are different, the OLE DB provider or ODBC driver converts the data when it is moved. The set of conversions supported by each OLE DB provider and ODBC driver are specified in the documentation for the provider or driver.
Using Variables and Parameters