I want know data type for columns in my table. For this I called ODBC function SQLColumns . But for each column which has type "date" this function says that column is varchar, but it is not so. Information about data type I know through the field "DATA_TYPE" which return int code of type -9, but this code must be 91. What's the problem, please tell me.
P.S. I use for retrieving information about columns standard C++ code example which is on official page. P.P.S For other DBMS this function SQLColumns() works correctly
Thank you!
3条答案
按热度按时间kadbb4591#
I would guess its dependent on the ODBC driver you are using. If it does not support (or request) 2008 or later TDS version, then the type DATE will correctly be returned as VARCHAR.
g6ll5ycj2#
You could run a query to get the table column info:
Output:
tjrkku2a3#
When the type comes back as
WVARCHAR(-9)
, you have to look at thesqlTypeName
as obtained byIt will contain
date
,time
, ordatetime2
. TypeWVARCHAR(-9)
is not returned when the data column is adatetime
.