Pervasive.SQL Supported Data Types
The following table shows information about the transactional and relational data types supported by Pervasive.SQL. The SRDE converts the relational data types to ODBC default types unless another data type conversion is specified when SQLGetData or SQLBindCol is called. (For a discussion of data type conversions, see the data types appendix in the Microsoft ODBC Programmer's Reference.). Items that are not applicable are designated "n/a."
Table A-1 Pervasive.SQL Data Types and Equivalent ODBC Data Types
Transactional Type (Size) |
Relational Type |
ODBC Type (code) |
Type Code |
Size (bytes) |
Create/Add Parameters |
Notes |
AUTOINC(2) |
SMALLIDENTITY |
SQL_SMALLINT(5) |
15 |
2 |
|
|
AUTOINC(4) |
IDENTITY |
SQL_INTEGER(4) |
15 |
4 |
|
|
BFLOAT(4) |
BFLOAT4 |
SQL_REAL(7) |
9 |
4 |
p2 |
n4 |
BFLOAT(8) |
BFLOAT8 |
SQL_DOUBLE(8) |
9 |
8 |
p2 |
n4 |
BLOB |
LONGVARBINARY |
SQL_LONGVARBINARY (-4) |
22 |
n/a |
p2 |
n2, n3, n6 |
CHAR |
BINARY |
SQL_BINARY(-2) |
0 |
1-255 |
p1 |
n2, n3 |
CHAR |
CHAR |
SQL_CHAR(1) |
0 |
1-255 |
p1 |
n1 |
CLOB |
LONGVARCHAR |
SQL_LONGVARCHAR (-1) |
21 |
n/a |
p4 |
n5, n6 |
CURRENCY |
CURRENCY |
SQL_DECIMAL(3) |
19 |
8 |
p2 |
|
DATE |
DATE |
SQL_DATE(9) |
3 |
4 |
p2 |
|
DECIMAL |
DECIMAL |
SQL_DECIMAL(3) |
5 |
1-64 |
p3 |
|
FLOAT(4) |
REAL |
SQL_REAL(7) |
2 |
4 |
p2 |
|
FLOAT(8) |
DOUBLE |
SQL_DOUBLE(8) |
2 |
8 |
p2 |
|
INTEGER(1) |
TINYINT |
SQL_TINYINT(-6) |
1 |
1 |
p2 |
|
INTEGER(2) |
SMALLINT |
SQL_SMALLINT(5) |
1 |
2 |
P2 |
|
INTEGER(4) |
INTEGER |
SQL_INTEGER(4) |
1 |
4 |
p2 |
|
INTEGER(8) |
BIGINT |
SQL_DECIMAL(3) |
1 |
8 |
p2 |
|
NUMERIC |
NUMERIC |
SQL_NUMERIC(2) |
8 |
1-15 |
p3 |
n4 |
NUMERICSA |
NUMERICSA |
SQL_NUMERIC(2) |
18 |
1-15 |
p3 |
n4 |
NUMERICSTS |
NUMERICSTS |
SQL_NUMERIC(2) |
17 |
1-14 |
p3 |
n4 |
TIME |
TIME |
SQL_TIME(10) |
4 |
4 |
p2 |
|
TIMESTAMP |
TIMESTAMP |
SQL_TIMESTAMP(11) |
20 |
8 |
p2 |
|
UNSIGNED(1) |
UTINYINT |
SQL_TINYINT(-6) |
14 |
1 |
p2 |
|
UNSIGNED(2) |
USMALLINT |
SQL_SMALLINT(5) |
14 |
2 |
p2 |
|
UNSIGNED(4) |
UINTEGER |
SQL_INTEGER(4) |
14 |
4 |
p2 |
|
UNSIGNED(8) |
UBIGINT |
SQL_DECIMAL(3) |
14 |
8 |
p2 |
|
WSTRING |
n/a |
n/a |
25 |
n/a |
|
n7 |
WSZSTRING |
n/a |
n/a |
26 |
n/a |
|
n7 |
ZSTRING |
VARCHAR |
SQL_VARCHAR(12) |
11 |
1-254 |
p1 |
n5 |
none |
BIT |
SQL_BIT(-7) |
16 |
1 bit |
|
n6 |
Add/Create Parameters
p1 - SIZE, NOT NULL, CASE
p2 - NOT NULL
p3 - PRECISION (1-15), SCALE (0-15), NOT NULL
p4 - NOT NULL, CASE
Notes
n1 - padded with spaces
n2 - flag set in FIELD.DDF to tell SQL to use binary
n3 - padded with binary zeros
n4 - cannot be used as variable or in stored procedures
n5 - not padded
n6 - cannot be indexed
n7 - transactional only
Data Type Ranges
The following table lists the value range for the Pervasive.SQL data types.
Table A-2 Pervasive.SQL Data Type Ranges
Relational Data Type |
Valid Value Range |
BFLOAT4 |
-2.93873588e-39 - 1.70141173e+38 |
BFLOAT8 |
-2.93873588e-39 - 1.70141183e+38 |
BIGINT |
-9223372036854775808 - 9223372036854775808 |
BINARY |
range not applicable |
BIT |
0 or 1 |
CHAR |
range not applicable |
CURRENCY |
-922337203685477.5808 - 922337203685477.5807 |
DATE |
01-01-0001 - 12-31-9999 |
DECIMAL |
depends on the length and number of decimal places |
DOUBLE |
-2.2250738585072e-308 - 1.79769313486232e+308 |
FLOAT (4) |
-2.2250738585072e-308 - 1.79769313486232e+308 |
FLOAT (8) |
-1.17549e-38 - 3.402823e+38 |
IDENTITY |
1 - 2147483647 |
INTEGER |
-2147483648 - 2147483647 |
LONGVARBINARY |
range not applicable |
LONGVARCHAR |
range not applicable |
MONEY |
-99999999999999999.99 - 99999999999999999.99 |
NUMERIC |
depends on the length and number of decimal places |
NUMERICSA |
depends on the length and number of decimal places |
NUMERICSTS |
depends on the length and number of decimal places |
REAL |
-1.17549e-38 - 3.402823e+38 |
SMALLIDENTITY |
1 - 32767 |
SMALLINT |
-32768 - 32767 |
TIME |
00:00:00 - 23:59:59 |
TIMESTAMP |
0001-01-01 00:00:00.0000000 - 9999-12-31 23:59:59.9999999 UTC |
TINYINT |
-128 - 127 |
UBIGINT |
0 - 18446744073709551615 |
UINTEGER |
0 - 4294967295 |
USMALLINT |
0 - 65535 |
UTINYINT |
0 - 255 |
VARCHAR |
range not applicable |