Table 7-5 shows how Adaptive Server datatypes are represented in Sybase IQ. When transferring the datatypes, Adaptive Server makes any necessary transformations to convert its data to the indicated IQ format.
Adaptive Server |
IQ |
||
---|---|---|---|
Datatype |
Size (in bytes) |
Datatype |
Size (in bytes) |
bigint unsigned bigint |
8 |
bigint unsigned bigint |
8 |
int unsigned int |
4 |
int unsigned int |
4 |
smallint |
2 |
smallint |
2 |
unsigned smallint |
2 |
int |
2 |
tinyint |
1 |
tinyint |
1 |
numeric(P,S) decimal(P,S) |
2 – 17 |
numeric(P,S) decimal(P,S) |
2 – 26 |
double precision |
8 |
double |
8 |
real |
4 |
real |
4 |
float(P) |
4, 8 |
float(P) |
4, 8 |
money |
8 |
money IQ stores this as numeric(19,4) |
16 |
smallmoney |
4 |
smallmoney IQ stores this as numeric(10,4) |
8 |
bigdatetime datetime |
8 |
datetime |
8 |
smalldatetime |
4 |
smalldatetime |
8 |
date |
4 |
date |
4 |
time |
4 |
time |
8 |
bigtime |
8 |
time |
8 |
char(N) |
1 – 16296 |
char(N) |
1 – 16296 |
char(N) (null) |
1 – 16296 |
char(N) (null) |
1 – 16296 |
varchar(N) (null) |
1 – 16296 |
varchar(N) (null) |
1 – 16296 |
unichar(N) |
1– 8148 |
binary(N*2) |
1 – 16296 |
unichar(N) nullunivarchar(N) (null) |
1– 8148 |
varbinary(N*2) (null) |
1 – 16296 |
binary(N) |
1 – 16296 |
binary(N) |
1 – 16296 |
varbinary(N) |
1 – 16296 |
varbinary(N) |
1 – 16296 |
binary(N) nullvarbinary(N) (null) |
1 – 16296 |
varbinary(N) (null) |
1 – 16296 |
bit |
1 |
bit |
1 |
timestamp |
8 |
varbinary(8) null |
8 |
Consider the following when converting Adaptive Server datatypes to datatypes for IQ:
Define precision and scale the same on IQ and Adaptive Server.
The storage size for float is 4 or 8 bytes, depending on precision. If you do not supply a value for precision, Adaptive Server stores float as double precision, but IQ stores it as real. Adaptive Server does not convert floating-point data to other formats for transfer to IQ. If you must use approximate numeric types, specify them as double or real, rather than as float.
The maximum length in Adaptive Server for a column with datatypes char, unichar, or binary depends on your installation’s page size. The maximum size specified in Table 7-5 is the largest possible column in a 16K page.
Adaptive Server typically requires two bytes per character to store Unicode characters. Because IQ does not include the Unicode datatype, Adaptive Server transmits unichar(N) to IQ as binary(N X 2). However, Adaptive Server does not transform Unicode characters: Adaptive Server pads Unicode strings with NULL(0x00) to transfer them to IQ.
IQ does not have a native Unicode datatype. Adaptive Server transfers Unicode strings to IQ as binary data, that is, two bytes long for each Unicode character. For example, unichar(40) in Adaptive Server converts to binary(80) in IQ. IQ cannot display the Unicode data as strings after the transfer.