Skip to main content

Integer Codes for Data Types

Integer Codes for Data Types

In query metadata and other contexts, the defined data type for a column may be returned as an integer code. The CType (client data type) integer codes are listed in the %SQL.StatementColumnOpens in a new tab clientTypeOpens in a new tab property. For further details, refer to Select-item Metadata.

SQLType data type codes are used by ODBC and JDBC. ODBC data type codes are returned by %SQL.Statement.%Metadata.columns.GetAt() method, as shown in the example above. SQL Shell metadata also returns ODBC data type codes. The JDBC codes are the same as the ODBC codes, except in the representation of time and date data types. These ODBC and JDBC values are listed below:

ODBC JDBC Data Type
-11 -11 GUID
-7 -7 BIT
-6 -6 TINYINT
-5 -5 BIGINT
-4 -4 LONGVARBINARY
-3 -3 VARBINARY
-2 -2 BINARY
-1 -1 LONGVARCHAR
0 0 Unknown type
1 1 CHAR
2 2 NUMERIC
3 3 DECIMAL
4 4 INTEGER
5 5 SMALLINT
6 6 FLOAT
7 7 REAL
8 8 DOUBLE
9 91 DATE
10 92 TIME
11 93 TIMESTAMP
12 12 VARCHAR

For further details, refer to Dynamic SQL.

InterSystems IRIS also supports Unicode SQL types for ODBC applications working with multibyte character sets, such as in Chinese, Hebrew, Japanese, or Korean locales.

ODBC Data Type
-10 WLONGVARCHAR
-9 WVARCHAR

To activate this functionality, refer to Using an InterSystems Database as an ODBC Data Source on Windows.

FeedbackOpens in a new tab