# test all types using ODBC 2 select "unsigned smallint" 123 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 5 attr SQL_DESC_UNSIGNED SQL_TRUE select "unsigned int" 12356 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_UNSIGNED SQL_TRUE select "unsigned bigint" 1235678901234 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 20 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 20 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 20 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 attr SQL_DESC_UNSIGNED SQL_TRUE select bit 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 1 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 1 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 1 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 1 attr SQL_DESC_TYPE_NAME bit attr SQL_DESC_UNSIGNED SQL_TRUE select tinyint 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 3 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 3 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 3 attr SQL_DESC_UNSIGNED SQL_TRUE select smallint 0 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 6 attr SQL_DESC_UNSIGNED SQL_FALSE select int 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 attr SQL_DESC_UNSIGNED SQL_FALSE tds_version_cmp tds70 == 7.0 if not tds70 select bigint 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 attr SQL_DESC_UNSIGNED SQL_FALSE endif select real 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 7 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 7 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 7 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 14 attr SQL_DESC_UNSIGNED SQL_FALSE select float 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 15 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 15 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 15 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 24 attr SQL_DESC_UNSIGNED SQL_FALSE select smallmoney 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL attr SQL_DESC_UNSIGNED SQL_FALSE select money 0 attr SQL_COLUMN_LENGTH 21 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 21 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 21 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL attr SQL_DESC_UNSIGNED SQL_FALSE select numeric(10,2) 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 2 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 2 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_UNSIGNED SQL_FALSE select numeric(23,4) 0 attr SQL_COLUMN_LENGTH 25 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 25 attr SQL_DESC_PRECISION 23 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 25 attr SQL_DESC_UNSIGNED SQL_FALSE select datetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 3 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_CONCISE_TYPE SQL_TIMESTAMP select smalldatetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 16 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 16 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 0 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 19 attr SQL_DESC_CONCISE_TYPE SQL_TIMESTAMP select char(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_TYPE_NAME char select varchar(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 attr SQL_DESC_TYPE_NAME varchar select nchar(12) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_TYPE_NAME nchar select nvarchar(13) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 26 39 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 attr SQL_DESC_OCTET_LENGTH 26 39 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_TYPE_NAME nvarchar select text 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 attr SQL_DESC_TYPE_NAME text select ntext 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 attr SQL_DESC_TYPE_NAME ntext select binary(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 select varbinary(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 22 select image 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8192 # test all types using ODBC 3 odbc 3 select "unsigned smallint" 123 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 5 select bit 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 1 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 1 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 1 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 1 select tinyint 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 3 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 3 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 3 select smallint 0 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 6 select int 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 if not tds70 select bigint 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 endif select real 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 7 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 24 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 24 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 14 select float 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 15 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 53 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 53 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 24 select smallmoney 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL select money 0 attr SQL_COLUMN_LENGTH 21 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 21 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 21 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL select numeric(10,2) 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 2 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 2 attr SQL_DESC_DISPLAY_SIZE 12 select numeric(23,4) 0 attr SQL_COLUMN_LENGTH 25 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 25 attr SQL_DESC_PRECISION 23 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 25 select datetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 3 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP select smalldatetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 16 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 16 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 0 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 19 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP select char(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 select varchar(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 select nchar(12) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_TYPE_NAME nchar select nvarchar(13) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 26 39 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 attr SQL_DESC_OCTET_LENGTH 26 39 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_TYPE_NAME nvarchar select text 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 select ntext 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 attr SQL_DESC_TYPE_NAME ntext select binary(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 select varbinary(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 22 select image 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8192 select uniqueidentifier 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 36 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 36 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 36 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 36 attr SQL_DESC_TYPE_NAME uniqueidentifier tds_version_cmp tds71p >= 7.1 if tds71p select sql_variant 'hello' attr SQL_DESC_CONCISE_TYPE SQL_SS_VARIANT attr SQL_DESC_TYPE SQL_SS_VARIANT attr SQL_COLUMN_LENGTH 0 attr SQL_COLUMN_PRECISION 8000 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 8000 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 8000 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8000 attr SQL_DESC_TYPE_NAME sql_variant select int 654 select sql_variant 123 attr SQL_DESC_CONCISE_TYPE SQL_SS_VARIANT attr SQL_DESC_TYPE SQL_SS_VARIANT attr SQL_COLUMN_LENGTH 0 attr SQL_COLUMN_PRECISION 8000 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 8000 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 8000 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8000 attr SQL_DESC_TYPE_NAME sql_variant endif # check for mssql 2008 date/time types tds_version_cmp tds73p >= 7.3 if tds73p set DESC_PRECISION 2 set DESC_SCALE 2 select time(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 13 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_OCTET_LENGTH 12 set DESC_PRECISION 2 set DESC_SCALE 2 select datetime2(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 24 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 24 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 select datetimeoffset(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 31 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE_NAME datetimeoffset attr SQL_DESC_DISPLAY_SIZE 31 attr SQL_DESC_OCTET_LENGTH 20 set DESC_PRECISION 2 set DESC_SCALE 2 select time(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 12 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_OCTET_LENGTH 12 set DESC_PRECISION 2 set DESC_SCALE 2 select datetime2(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 # select datetime2 '2015-09-09 12:23:34' select datetime2 '12:23:34' attr SQL_DESC_SCALE 7 attr SQL_DESC_LENGTH 27 attr SQL_DESC_PRECISION 7 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 27 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 select datetimeoffset(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 30 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE_NAME datetimeoffset attr SQL_DESC_DISPLAY_SIZE 30 attr SQL_DESC_OCTET_LENGTH 20 set DESC_PRECISION 2 set DESC_SCALE 2 select date '2011-08-06' attr SQL_DESC_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE_NAME date attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_OCTET_LENGTH 6 endif tds_version_cmp tds72p >= 7.2 if tds72p select varchar(max) 'test' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_VARCHAR select nvarchar(max) 'test' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_WVARCHAR select varbinary(max) '4142434445' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_VARBINARY select xml """'ciaohi'""" attr SQL_DESC_CONCISE_TYPE SQL_SS_XML attr SQL_DESC_TYPE SQL_SS_XML attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 endif tds_version_cmp tds50 == 5.0 if tds50 set DESC_PRECISION 2 set DESC_SCALE 2 select time '12:34:56.543' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 12 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE_NAME time attr SQL_COLUMN_SCALE 3 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_DISPLAY_SIZE 12 set DESC_PRECISION 2 set DESC_SCALE 2 select date '2011-08-06' attr SQL_DESC_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE_NAME date attr SQL_COLUMN_SCALE 0 attr SQL_DESC_OCTET_LENGTH 6 attr SQL_DESC_DISPLAY_SIZE 10 set DESC_PRECISION 2 set DESC_SCALE 2 select bigtime '12:34:56.543765' attr SQL_DESC_SCALE 6 attr SQL_DESC_LENGTH 15 attr SQL_DESC_PRECISION 6 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE_NAME bigtime attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_DISPLAY_SIZE 15 set DESC_PRECISION 2 set DESC_SCALE 2 select bigdatetime """'2011-08-06 12:34:56.543'""" attr SQL_DESC_SCALE 6 attr SQL_DESC_LENGTH 26 attr SQL_DESC_PRECISION 6 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME bigdatetime attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_DISPLAY_SIZE 26 # these types resemble more MS driver than Sybase one # to be coherent with NVARCHAR select univarchar(30) 'test123' attr SQL_DESC_SCALE 0 attr SQL_DESC_PRECISION 30 attr SQL_DESC_LENGTH 30 attr SQL_DESC_CONCISE_TYPE SQL_WVARCHAR attr SQL_DESC_TYPE SQL_WVARCHAR attr SQL_DESC_TYPE_NAME univarchar attr SQL_DESC_OCTET_LENGTH 60 attr SQL_DESC_DISPLAY_SIZE 30 select unichar(30) 'test123' attr SQL_DESC_SCALE 0 attr SQL_DESC_PRECISION 30 attr SQL_DESC_LENGTH 30 attr SQL_DESC_CONCISE_TYPE SQL_WCHAR attr SQL_DESC_TYPE SQL_WCHAR attr SQL_DESC_TYPE_NAME unichar attr SQL_DESC_OCTET_LENGTH 60 attr SQL_DESC_DISPLAY_SIZE 30 endif # some additional tests using ARD set DESC_CONCISE_TYPE SQL_NUMERIC set DESC_PRECISION 4 set DESC_SCALE 2 set DESC_CONCISE_TYPE SQL_INTEGER attr DESC_TYPE SQL_INTEGER # TODO #attr DESC_LENGTH 4 #attr DESC_PRECISION 4 #attr DESC_SCALE 2