Host variable datatypes must be compatible with the datatypes of the corresponding database columns. So, before writing your application program, check the datatypes of the database columns. To ensure that your host variables are compatible with the Adaptive Server datatypes, use the Sybase-supplied type definitions.
The following table shows and briefly describes the equivalent datatypes. For detailed descriptions of each Adaptive Server datatype, see the Adaptive Server Enterprise Reference Manual.
Sybase-supplied typedef |
Description |
C datatype |
Adaptive Server datatype |
---|---|---|---|
CS_BINARY |
Binary type |
unsigned char |
binary, varbinary |
CS_BIT |
Bit type |
unsigned char |
boolean |
CS_CHAR |
Character type |
char[n] |
char, varchar |
CS_DATE |
4-byte date type |
None |
date |
CS_TIME |
4-byte time type |
None |
time |
CS_DATETIME |
8-byte datetime type |
None |
datetime |
CS_DATETIME4 |
4-byte datetime type |
None |
smalldatetime |
CS_TINYINT |
1-byte integer type |
unsigned char |
tinyint |
CS_SMALLINT |
2-byte integer type |
short |
smallint |
CS_INT |
4-byte integer type |
long |
int |
CS_DECIMAL |
Decimal type |
None |
decimal |
CS_NUMERIC |
Numeric type |
None |
numeric |
CS_FLOAT |
8-byte float type |
double |
float |
CS_REAL |
4-byte float type |
float |
real |
CS_MONEY |
8-byte money type |
None |
money |
CS_MONEY4 |
4-byte money type |
None |
smallmoney |
CS_TEXT |
Text type -y option required |
unsigned char |
text |
CS_IMAGE |
Image type -y option required |
unsigned char |
image |