TechNet
Export (0) Print
Expand All

SQLGetDescRec

 

This topic discusses SQLGetDescRec functionality that is specific to SQL Server Native Client.

SQLGetDescRec can be used to get values for attributes of table-valued parameters and table-valued parameter columns. The RecNumber parameter of SQLGetDescRec corresponds to the ParameterNumber parameter of SQLBindParameter.

Table-valued parameter columns are only available when the descriptor header field SQL_SOPT_SS_PARAM_FOCUS is set to the ordinal of a record that has SQL_DESC_TYPE set to SQL_SS_TABLE. For more information about SQL_SOPT_SS_PARAM_FOCUS about, see SQLSetStmtAttr.

SQLGetDescRec returns the following data:

ParameterTable-valued parameterTable-valued parameter columns and other parameters
NameThe formal parameter name for a stored procedure call; otherwise, a 0 length string.The table-valued parameter column name.
TypePtrSQL_DESC_TYPE. For table-vaued parameters, this is SQL_SS_TABLE.SQL_DESC_TYPE
SubTypePtrUndefinedSQL_DESC_DATETIME_INTERVAL_CODE (For records of type SQL_DATETIME or SQL_INTERVAL.)
LengthPtr0SQL_DESC_OCTET_LENGTH
PrecisionPtr0SQL_DESC_PRECISION
ScalePtr0SQL_DESC_SCALE
NullablePtr1SQL_DESC_NULLABLE

For more information about table-valued parameters, see Table-Valued Parameters (ODBC).

The values returned for date/time types are as follows:

TypePtrSubTypePtrLengthPtrPrecisionPtrScalePtr
datetimeSQL_DATETIMESQL_CODE_TIMESTAMP433
smalldatetimeSQL_DATETIMESQL_CODE_TIMESTAMP800
dateSQL_DATETIMESQL_CODE_DATE600
timeSQL_SS_TIME20100..70..7
datetime2SQL_DATETIMESQL_CODE_TIMESTAMP160..70..7
datetimeoffsetSQL_SS_TIMESTAMPOFFSET0200..70..7

For more information, see Date and Time Improvements (ODBC).

SQLGetDescRec supports large CLR user-defined types (UDTs). For more information, see Large CLR User-Defined Types (ODBC).

SQLGetDescRec
ODBC API Implementation Details

Community Additions

ADD
Show:
© 2016 Microsoft