Search code examples
c++sql-server-2012odbctable-valued-parameters

undeclared identifier SQL_SS_TABLE


I would like to work with Table valued parameter in C++ using ODBC. There are many interssting samples for working with TVPs with ODBC. For example here

A very nice function is SQLbinparameter. From here for Table Valued parameter this function should be looked like this:

r = SQLBindParameter(hstmt, 
    2,// ParameterNumber
    SQL_PARAM_INPUT,// InputOutputType
    SQL_C_DEFAULT,// ValueType 
    SQL_SS_TABLE,// Parametertype
    ITEM_ARRAY_SIZE,// ColumnSize: For a table-valued parameter this is the row array size.
    0,// DecimalDigits: For a table-valued parameter this is always 0. 
    TVP,// ParameterValuePtr: For a table-valued parameter this is the type name of the 
//table-valued parameter, and also a token returned by SQLParamData.
    SQL_NTS,// BufferLength: For a table-valued parameter this is the length of the type name or SQL_NTS.
    &cbTVP);// StrLen_or_IndPtr: For a table-valued parameter this is the number of rows actually use

But I recieve the error: error C2065: SQL_SS_TABLE undeclared identifier

what should I do to solve this problem?


Solution

  • I am going to guess that you are attempting to use this feature on Linux, and the most popular linux ODBC package (unixODBC) simply does not support this feature.

    There is a chance if you use the official Microsoft driver (Microsoft ODBC Driver for SQL Server on Linux) this feature will be supported.