Database datatypes

The predicate sqltype/2 can translate a datatype number to a datatype string.

sqltype(DataType, DataTypeString)

func Translate a datatype number to a datatype name.
pre The variable DataType must contain an integer value.
post If the datatype was a valid datatype number then a string was assigned to the variable DataTypeString, else the string 'unknown' was assigned to the variable DataTypeString.

 

Data number Datatype name
0 unknown
1 char
2 numeric
3 decimal
4 integer
5 smallint
6 float
7 real
8 double
9 datetime (in ODBC 3.5 the constants 'date' and datetime' both have id 9)
10 time (in ODBC 3.5 the constants 'time' and interval' both have id 10)
11 timestamp
12 varchar
91 date (for ODBC 3.0 or higher)
92 time (for ODBC 3.0 or higher)
93 datetime (for ODBC 3.0 or higher
-1 longvarchar (long data field, also known as a blob field)
-2 binary
-3 varbinary
-4 longvarbinary (long data field, blob field)
-5 bigint
-6 tinyint
-7 bit
-8 wchar (unicode character field, ODBC 3.0 or higher)
-9 wvarchar (unicode character field, ODBC 3.0 or higher)
-10 wlongvarchar (long data unicode field, blob field, ODBC 3.0 or higher)
-11 guid (new in ODBC3.5)
all remaining unknown