[unixODBC-support] Columntype datetime2 returned by SQLDescribeCol strange

Nick Gorham nick at lurcher.org
Mon Oct 1 07:54:55 BST 2012


On 01/10/12 07:43, Björn Lundin wrote:
> Hi!
>
> This is posted also to freetds maillist, but I now think it should be posted here.
>
> I have a Raspberry Pi (arm platform) running debian 6
> which has unixodbc .
>
> I installed this :
>
> sudo apt-get install unixodbc unixodbc-dev odbcinst freetds
> freetds-dev freetds-bin
>
> and when I run a program towards a sql-server I get
>
> Message: [Proc=SQLDescribeParam][Server=][State=IM001][unixODBC][Driver
> Manager]Driver does not support this function
>
> Ok, too bad, but I can live without that function.
>
> However, when I run the same code on a windows client, it goes well,
> using MS native client.
>
>
> Anyway, my real problem is that when I have a DateTime2(3) column,
> SQLDescribeCol returns
> * SQL_VARCHAR
>
> with MS native windows driver I get one of (not sure which, I treat
> them equally)
> * SQL_TYPE_TIMESTAMP
> * SQL_DATETIME
>
> Is there a way around this, to tell the client library to return a
> correct datatype?
>
> I'm not quite sure what lib or layer I'm supposed to look at.
> odbc or tds, but I guess odbc.

Hi,

Its down to the driver, not unixODBC. I would assume its not using the 
latest TDS version, so the server is describing things to the driver as 
CHAR types. The Easysoft driver (for example) does use the latest TDS 
version, so the driver does report the type as SQL_TIMESTAMP.

Likewise SQLDescribeParam is down to the driver to support or not.

-- 
Nick
>
> isql does this:
> (its column IXXLUTS that is behaving strange)
> +---------------------------------------+
> | Connected!                            |
> |                                       |
> | sql-statement                         |
> | help [tablename]                      |
> | quit                                  |
> |                                       |
> +---------------------------------------+
> SQL> help bseq
> +------------------+--------------+------------+--------------+----------+-------------+------------
> | TABLE_QUALIFIER  | TABLE_OWNER  | TABLE_NAME | COLUMN_NAME  |
> DATA_TYPE| TYPE_NAME   | PRECISION
> +------------------+--------------+------------+--------------+----------+-------------+------------
> | sattmate         | dbo          | BSEQ       | BSQPSTO      | 12
>    | varchar     | 2
> | sattmate         | dbo          | BSEQ       | BSQDSTO      | 12
>    | varchar     | 2
> | sattmate         | dbo          | BSEQ       | BSQTRTYP     | 4
>    | int         | 10
> | sattmate         | dbo          | BSEQ       | BSQID        | 12
>    | varchar     | 4
> | sattmate         | dbo          | BSEQ       | BSQPRIOR     | 4
>    | int         | 10
> | sattmate         | dbo          | BSEQ       | BSQBEGPR     | 12
>    | varchar     | 15
> | sattmate         | dbo          | BSEQ       | IXXLUPD      | 12
>    | varchar     | 12
> | sattmate         | dbo          | BSEQ       | IXXLUTS      | -9
>    | datetime2   | 23
> +------------------+--------------+------------+--------------+----------+-------------+------------
>
>
> +------------+-------+-------+---------+---------+------------+--------------+-----------------
> | LENGTH     | SCALE | RADIX | NULLABLE| REMARKS | COLUMN_DEF |
> SQL_DATA_TYPE| SQL_DATETIME_SUB
> +------------+-------+-------+---------+---------+------------+--------------+-----------------
> | 2          |       |       | 0       |         | (' ')      | 12
>        |
> | 2          |       |       | 0       |         | (' ')      | 12
>        |
> | 4          | 0     | 10    | 0       |         | ((1))      | 4
>        |
> | 4          |       |       | 0       |         | (' ')      | 12
>        |
> | 4          | 0     | 10    | 1       |         | ((1))      | 4
>        |
> | 15         |       |       | 0       |         | (' ')      | 12
>        |
> | 12         |       |       | 0       |         | (' ')      | 12
>        |
> | 46         |       |       | 0       |         |            | -9
>        |
> +------------+-------+-------+---------+---------+------------+--------------+-----------------
>
>
> +------------------+-----------------+-------------+-------------+
> | CHAR_OCTET_LENGTH| ORDINAL_POSITION| IS_NULLABLE | SS_DATA_TYPE|
> +------------------+-----------------+-------------+-------------+
> | 2                | 1               | NO          | 39          |
> | 2                | 2               | NO          | 39          |
> |                  | 3               | NO          | 56          |
> | 4                | 4               | NO          | 39          |
> |                  | 5               | YES         | 38          |
> | 15               | 6               | NO          | 39          |
> | 12               | 7               | NO          | 39          |
> |                  | 8               | NO          | 0           |
> +------------------+-----------------+-------------+-------------+
>
> SQLRowCount returns 8
>
> /Björn
> Skickat från min iPad
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at mailman.unixodbc.org
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support



More information about the unixODBC-support mailing list