none
Retrieving Column comments using MS SQL Server ODBC driver

    Question

  • I am using the following function call to retrieve the REMARKS of a column of my MS SQL server table.

    SQLBindCol(st_handle,12, SQL_C_WCHAR,comment,512-1, &l);

    But comment is always an empty string.All other columns are retrieved successfully.

    Is there any setting that needs to be set in ODBC configuration?


    Wednesday, September 11, 2013 1:10 PM

All replies

  • Hi Sudhindra123,

    From the codes syntax, there is no error. An ODBC 3.0 or 2.x application will always bind to the ANSI data types. For optimum performance, an ODBC 3.5 (or higher) application should bind to the ANSI data C type if the SQL column type is ANSI, and should bind to the Unicode C data type if the SQL column type is Unicode. Please check the data type of column 12 and ODBC version.

    Unicode Data
    http://msdn.microsoft.com/en-us/library/ms714102(v=vs.85).aspx

    BUG: SQL Server ODBC Driver Incorrectly Maps Unicode Datatypes with SQL_C_DEFAULT
    http://support.microsoft.com/kb/293659


    Allen Li
    TechNet Community Support

    Friday, September 13, 2013 2:41 AM
    Moderator
  • We use the following function call the ODBC behaviour.

    SQLSetEnvAttr(m_henv, SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3, 0);

    I have even tried setting it to 3.8 using the following function call. 

    SQLSetEnvAttr(m_henv, SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3_80, 0);

    But the problem still persists.

    Wednesday, September 18, 2013 12:01 PM