| Store | Cart

SQL data type codes

From: Steffen Goeldner <s.go...@eurodata.de>
Tue, 06 Nov 2001 09:58:24 +0100
Attached is a collection of SQL data type codes used by SQL/CLI, DBI
and ODBC.
Some remarks/questions:

 1) The listed SQL/CLI type codes are defined in the current working
    draft.
    Does anybody own the final SQL-1999 standard and has the kindness
    to compare the code lists of both documents?

 2) Should DBI adopt the new SQL/CLI type codes?
    Or should DBI wait until ODBC adopts the standard?

 3) SQL/CLI and ODBC define different codes for SQL_BIT.
    Which definition takes precedence for DBI?

 4) Temporal datatypes tell a story of their own, see e.g.:
    http://www.xray.mpe.mpg.de/mailing-lists/dbi/2001-08/msg00822.html


Steffen
SQL data type codes
===================

                               SQL/CLI   DBI  ODBC
 ----------------------------  -------  ----  ----
 SQL_GUID                                      -11
 SQL_WLONGVARCHAR                        -10   -10
 SQL_WVARCHAR                             -9    -9
 SQL_WCHAR                                -8    -8
 SQL_BIT                                  -7    -7
 SQL_TINYINT                              -6    -6
 SQL_BIGINT                               -5    -5
 SQL_LONGVARBINARY                        -4    -4
 SQL_VARBINARY                            -3    -3
 SQL_BINARY                               -2    -2
 SQL_LONGVARCHAR                          -1    -1
 SQL_UNKNOWN_TYPE                                0
 SQL_CHAR                            1     1     1
 SQL_NUMERIC                         2     2     2
 SQL_DECIMAL                         3     3     3
 SQL_INTEGER                         4     4     4
 SQL_SMALLINT                        5     5     5
 SQL_FLOAT                           6     6     6
 SQL_REAL                            7     7     7
 SQL_DOUBLE                          8     8     8
 SQL_DATETIME                        9           9
 SQL_DATE                                  9     9
 SQL_INTERVAL                       10          10
 SQL_TIME                                 10    10
 SQL_TIMESTAMP                            11    11
 SQL_VARCHAR                        12    12    12
 SQL_BIT                            14
 SQL_BIT_VARYING                    15
 SQL_BOOLEAN                        16
 SQL_UDT                            17
 SQL_UDT_LOCATOR                    18
 SQL_ROW                            19
 SQL_REF                            20
 SQL_BLOB                           30
 SQL_BLOB_LOCATOR                   31
 SQL_CLOB                           40
 SQL_CLOB_LOCATOR                   41
 SQL_ARRAY                          50
 SQL_ARRAY_LOCATOR                  51
 SQL_TYPE_DATE                      91          91
 SQL_TYPE_TIME                      92          92
 SQL_TYPE_TIMESTAMP                 93          93
 SQL_TYPE_TIME_WITH_TIMEZONE        94
 SQL_TYPE_TIMESTAMP_WITH_TIMEZONE   95
 SQL_INTERVAL_YEAR                 101         100 + SQL_CODE_YEAR
 SQL_INTERVAL_MONTH                102         100 + SQL_CODE_MONTH
 SQL_INTERVAL_DAY                  103         100 + SQL_CODE_DAY
 SQL_INTERVAL_HOUR                 104         100 + SQL_CODE_HOUR
 SQL_INTERVAL_MINUTE               105         100 + SQL_CODE_MINUTE
 SQL_INTERVAL_SECOND               106         100 + SQL_CODE_SECOND
 SQL_INTERVAL_YEAR_TO_MONTH        107         100 + SQL_CODE_YEAR_TO_MONTH
 SQL_INTERVAL_DAY_TO_HOUR          108         100 + SQL_CODE_DAY_TO_HOUR
 SQL_INTERVAL_DAY_TO_MINUTE        109         100 + SQL_CODE_DAY_TO_MINUTE
 SQL_INTERVAL_DAY_TO_SECOND        110         100 + SQL_CODE_DAY_TO_SECOND
 SQL_INTERVAL_HOUR_TO_MINUTE       111         100 + SQL_CODE_HOUR_TO_MINUTE
 SQL_INTERVAL_HOUR_TO_SECOND       112         100 + SQL_CODE_HOUR_TO_SECOND
 SQL_INTERVAL_MINUTE_TO_SECOND     113         100 + SQL_CODE_MINUTE_TO_SECOND


References:
-----------

 SQL/CLI : http://www.jtc1sc32.org/sc32/jtc1sc32.nsf/Attachments/DF86E81BE70151D58525699800643F56/$FILE/32N0595T.PDF
           Annex A.1, C header file SQLCLI.H (page 325)
 DBI     : DBI-1.20/dbi_sql.h
 ODBC    : MDAC SDK 2.6, inc/sql.h, inc/sqlext.h, inc/sqlucode.h

Recent Messages in this Thread
Steffen Goeldner Nov 06, 2001 08:58 am
Tim Bunce Nov 06, 2001 05:31 pm
Steffen Goeldner Nov 07, 2001 10:58 am
Tim Bunce Nov 07, 2001 02:31 pm
Steffen Goeldner Nov 07, 2001 03:50 pm
Tim Bunce Nov 07, 2001 04:51 pm
Steffen Goeldner Nov 09, 2001 09:06 am
Steffen Goeldner Nov 09, 2001 09:20 am
Messages in this thread