Datatypes and Adaptive Server

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.

Table 4-4 shows and briefly describes the equivalent datatypes. For detailed descriptions of each Adaptive Server datatype, see the Adaptive Server Enterprise Reference Manual.

Table 4-4: Comparison of C and Adaptive Server-compatible datatypes

Sybase-supplied typedef

Description

C datatype

Adaptive Server datatype

CS_BIGINT

8-byte integer type

long long

bigint

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 unsigned 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

CS_UBIGINT

8-byte unsigned integer type

unsigned long long

ubigint

CS_UINT

4-byte unsigned integer type

unsigned int

uint

CS_UNICHAR

2-byte UTF-16 Unicode character type

unsigned short

unichar

CS_UNITEXT

2-byte UTF-16 Unicode text type

unsigned short

unitext

CS_USMALLINT

2-byte unsigned integer type

unsigned short

usmallint

CS_XML

XML type

unsigned char

xml