ODBC C data types represent those data types of C variables in which the application data intended for communication with the database is processed.
Relationship Between SQL and C Data Types
fCType |
ODBC C Typedef |
C Type |
SQL_C_CHAR |
SQLCHAR * |
unsigned char * |
SQL_C_SSHORT |
SQLSMALLINT |
short int |
SQL_C_SLONG |
SQLINTEGER |
long int (32 bit) |
SQL_C_USHORT |
SQLUSMALLINT |
unsigned short int |
SQL_C_ULONG |
SQLUINTEGER |
unsigned long int (32 bit) |
SQL_C_FLOAT |
SQLREAL |
float |
SQL_C_DOUBLE |
SQLDOUBLE |
double |
SQL_C_BIGINT |
SQLBIGINT |
_int64, long (64 bit) |
SQL_C_UBIGINT |
SQLUBIGINT |
unsigned _int64, unsigned long (64 bit) |
SQL_C_BINARY |
SQLCHAR* |
unsigned char* |
SQL_C_DATE |
SQL_DATE_STRUCT |
struct tagDATE_STRUCT { SQLSMALLINT year; SQLSMALLINT month; SQLSMALLINT day;} |
SQL_C_TIME |
SQL_TIME_STRUCT |
struct tagTIME_STRUCT { SQLSMALLINT hour; SQLSMALLINT minute; SQLSMALLINT second;} |
SQL_C_TIMESTAMP |
SQL_TIMESTAMP_STRUCT |
struct tagTIMESTAMP_STRUCT { SQLSMALLINT year; SQLSMALLINT month; SQLSMALLINT day; SQLSMALLINT hour; SQLSMALLINT minute; SQLSMALLINT second; SQLUINTEGER fraction;} |
SQL_C_BIT |
SQLCHAR |
unsigned char |