Adaptive Server Enterprise data type equivalents

The table below indicates the Adaptive Server Enterprise exact numeric types and the Sybase IQ equivalents.

Table 7-14: Integer data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

int

INT,BIGINT,UNSIGNED INT, UNSIGNED BIGINT, or NUMERIC

Sybase IQ does not allow scaled integers, such as INT(7,3). Data in the form INT(precision,scale) is converted to NUMERIC(precision,scale). This differs from Sybase IQ versions prior to 12.0, and from Adaptive Server Enterprise, in which int data types can be values between -2,147,483,648 and 2,147,483,647, inclusive.

To handle larger integer values, you can use a BIGINT, an unsigned integer (UNSIGNED INT), or an UNSIGNED BIGINT data type. With UNSIGNED INT, the last bit is used as part of the value. There is no positive or negative indication; all numbers are assumed to be positive, so the value can go up to 4,294,967,295.

numeric

DECIMAL or NUMERIC with appropriate precision

If the precision of the Sybase IQ data type you define is too small to store the Adaptive Server Enterprise value, the value converts to NULL.

decimal

DECIMAL or NUMERIC with appropriate precision

See above.

smallint

SMALLINT or NUMERIC

Sybase IQ SMALLINTdoes not allow precision and scale. Adaptive Server Enterprise smallint(precision,scale) is converted to NUMERIC(precision,scale)See INT above.

tinyint

TINYINT

Sybase IQ TINYINT columns do not allow precision and scale. Adaptive Server Enterprise tinyint(precision,scale) is converted to NUMERIC(precision,scale). See INT above.

bit

BIT

The following table indicates the Adaptive Server Enterprise approximate data types and the Sybase IQ equivalents.

Table 7-15: Approximate numeric data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

float (precision)

FLOAT (precision)

IQ supports greater precision for FLOAT

HNG indexes do not allow FLOAT, REAL, or DOUBLE data.

double precision

DOUBLE

real

REAL

The following table indicates the Adaptive Server Enterprise character data types and their Sybase IQ equivalents.

Table 7-16: Character data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

char

CHAR

Sybase IQ and Adaptive Server Enterprise character (char or CHAR) data types are the same except that Sybase IQ can handle NULLs. If you want an Sybase IQ CHAR column to exactly match an Adaptive Server Enterprise char column, specify Sybase IQ column as NOT NULL. Sybase IQ default allows NULLs. Adaptive Server Enterprise char columns that allow NULLs are internally converted to varchar.

varchar

VARCHAR

See char notes above.

nchar

Not supported

nvarchar

Not supported

text

Not supported

Sybase IQ does not support the Adaptive Server Enterprise data type text, but you can insert data from an ASE database column of data type text using INSERT...LOCATION.

The following table indicates the Adaptive Server Enterprise money data types and the Sybase IQ equivalents.

Table 7-17: Money data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

money

NUMERIC(19,4)

money data is converted implicitly to NUMERIC(19,4).

smallmoney

NUMERIC(10,4)

The following table indicates the Adaptive Server Enterprise DATE/TIME data types and the Sybase IQ equivalents.

Table 7-18: DATE/TIME data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

datetime

TIMESTAMP or DATE or TIME

Adaptive Server Enterprise datetime columns maintain date and time of day values in 4 bytes for number of days before or after base date of virtual date 0/0/0000 and 8 bytes for time of day, accurate to within one 1,000,000th of a second. Sybase IQ TIMESTAMP (or DATETIME) columns maintain date and time of day values in two 4-byte integers: 4 bytes for number of days since 1/1/0 and 4 bytes for time of day, based on 24-hour clock, accurate to within one 10,000th of a second. Sybase IQ automatically handles the conversion.

Sybase IQ also has a separate DATE data type, a single 4-byte integer. If you want to extract just a date from a SQL Server or Adaptive Server Enterprise datetime column, you can do this with Sybase IQ DATE data type. To do this, define an Sybase IQ DATE column with same name as the Adaptive Server Enterprise datetime column. Sybase IQ automatically picks up appropriate portion of datetime value.

smalldatetime

TIMESTAMP or DATETIME or DATE or TIME

Define Adaptive Server Enterprise smalldatetime columns as TIMESTAMP (or DATETIME) data type in Sybase IQ. Sybase IQ properly handles the conversion. As with regular datetime, if you want to extract just a date from an Adaptive Server Enterprise smalldatetime column, do it with the Sybase IQ DATE data type.

The following table indicates the Adaptive Server Enterprise binary data types and the Sybase IQ equivalents.

Table 7-19: Binary data types

Adaptive Server Enterprise Datatype

Sybase IQ Datatype

Notes

binary

BINARY

Sybase IQ pads trailing zeros on all BINARY columns. Always create BINARY columns with an even number of characters for length.

HNG indexes do not allow BINARY data.

varbinary

VARBINARY

Sybase IQ does not pad or truncate trailing zeros on VARBINARY columns. Always create VARBINARY columns with an even number of characters for length.

HNG indexes do not allow VARBINARY data.

If you use INSERT ... LOCATION to insert data selected from a VARBINARY column, set the LOAD_MEMORY_MB option on the local database to limit memory used by the insert, and set ASE_BINARY_DISPLAY to ‘OFF’ on the remote database.

Since the following Adaptive Server Enterprise data types are not supported, you must omit columns with these data types:

This also applies to any custom Adaptive Server Enterprise data type.