At times, you might need to get information about the data types that are supported by the data source, for example, precision and scale. You can use the ODBC function SQLGetTypeInfo to do this.
On Windows, you can use ODBC Test to call SQLGetTypeInfo against the ODBC data source to return the data type information. See "Diagnostic Tools" for details about ODBC Test.
On all platforms, an application can call SQLGetTypeInfo. Here is an example of a C function that calls SQLGetTypeInfo and retrieves the information in the form of a SQL result set.
// There are 19 columns returned by SQLGetTypeInfo.
// This example displays the first 3.
// Check the ODBC 3.x specification for more information.
// Variables to hold the data from each column
char typeName[30];
short sqlDataType;
unsigned int columnSize;
// Fetch the results from executing SQLGetTypeInfo
rc = SQLFetch(hstmt);
if (rc == SQL_ERROR) {
// Procedure to retrieve errors from the SQLGetTypeInfo function
ODBC_GetDiagRec(SQL_HANDLE_STMT, hstmt);
break;
}