Programmer Guide : Minimum SQL grammar requirements for ODBC : Parameter data types
  
Parameter data types
This topic describes how data types are determined for parameters and the parameter markers support.
Even though each parameter specified with SQLBindParameter is defined using an SQL data type, the parameters in an SQL statement have no intrinsic data type. Therefore, parameter markers can be included in an SQL statement only if their data types can be inferred from another operand in the statement. For example, in an arithmetic expression such as ? + COLUMN1, the data type of the parameter can be inferred from the data type of the named column represented by COLUMN1. An application cannot use a parameter marker if the data type cannot be determined.
The following table describes how a data type is determined for several types of parameters according to SQL-92 standards. For comprehensive information about inferring the parameter type, see the SQL-92 specification.
Location of parameter
Assumed data type
One operand of a binary arithmetic or comparison operator
Same as the other operand
The first operand in a BETWEEN clause
Same as the second operand
The second or third operand in a BETWEEN clause
Same as the first operand
An expression used with IN
Same as the first value or the result column of the subquery
A value used with IN
Same as the expression or the first value if there is a parameter marker in the expression
A pattern value used with LIKE
VARCHAR
An update value used with UPDATE
Same as the update column
Parameter markers
According to the SQL-92 specification, an application cannot place parameter markers in the following locations:
In a SELECT list.
As both expressions in a comparison-predicate.
As both operands of a binary operator.
As both the first and second operands of a BETWEEN operation.
As both the first and third operands of a BETWEEN operation.
As both the expression and the first value of an IN operation.
As the operand of a unary + or - operation.
As the argument of a set-function-reference.
For a comprehensive list and more details, see the SQL-92 specification.
See also
Minimum SQL grammar requirements for ODBC