--- title: "SQLGetDescField | Microsoft Docs" ms.custom: "" ms.date: "03/17/2017" ms.prod: "sql-server-2016" ms.reviewer: "" ms.suite: "" ms.technology: - "docset-sql-devref" ms.tgt_pltfrm: "" ms.topic: "reference" apitype: "DLLExport" helpviewer_keywords: - "SQLGetDescField function" ms.assetid: 3e59a37a-28ee-4c91-8968-7fe3b966739d caps.latest.revision: 52 author: "JennieHubbard" ms.author: "jhubbard" manager: "jhubbard" --- # SQLGetDescField [!INCLUDE[SNAC_Deprecated](../../includes/snac-deprecated.md)] The [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Native Client ODBC driver exposes driver-specific descriptor fields for the implementation row descriptor (IRD) only. Within the IRD, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] descriptor fields are referenced through driver-specific column attributes. For information about a complete list of available driver-specific descriptor fields, see [SQLColAttribute](../../relational-databases/native-client-odbc-api/sqlcolattribute.md). Descriptor fields that contain column identifier strings are often zero-length strings. All [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]-specific descriptor field values are read-only. Like attributes retrieved with SQLColAttribute, descriptor fields that report row-level attributes (such as SQL_CA_SS_COMPUTE_ID) are reported for all columns in the result set. ## SQLGetDescField and Table-Valued Parameters SQLGetDescField can be used to get values for extended attributes of table-valued parameters and table-valued parameter columns. For more information about table-valued parameters, see [Table-Valued Parameters (ODBC)](../../relational-databases/native-client-odbc-table-valued-parameters/table-valued-parameters-odbc.md). ## SQLGetDescField Support for Enhanced Date and Time Features For information about the descriptor fields available with the new date/time types, see [Parameter and Result Metadata](../../relational-databases/native-client-odbc-date-time/metadata-parameter-and-result.md). For more information, see [Date and Time Improvements (ODBC)](../../relational-databases/native-client-odbc-date-time/date-and-time-improvements-odbc.md). Beginning in [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)], SQLGetDescField can return **SQL_C_SS_TIME2** (for **time** types) or **SQL_C_SS_TIMESTAMPOFFSET** (for **datetimeoffset**) instead of **SQL_C_BINARY**, if your application uses ODBC 3.8. ## SQLGetDescField Support for Large CLR UDTs **SQLGetDescField** supports large CLR user-defined types (UDTs). For more information, see [Large CLR User-Defined Types (ODBC)](../../relational-databases/native-client/odbc/large-clr-user-defined-types-odbc.md). ## SQLGetDescField Support for Sparse Columns SQLGetDescField can be used to query the new IRD field SQL_CA_SS_IS_COLUMN_SET to determine if a column is a **column_set** column. For more information, see [Sparse Columns Support (ODBC)](../../relational-databases/native-client/odbc/sparse-columns-support-odbc.md). ## Example ``` typedef struct tagCOMPUTEBYLIST { SQLSMALLINT nBys; SQLSMALLINT aByList[1]; } COMPUTEBYLIST; typedef COMPUTEBYLIST* PCOMPUTEBYLIST; SQLHDESC hIRD; SQLINTEGER cbIRD; SQLINTEGER nSet = 0; // . . . // Execute a statement that contains a COMPUTE clause, // then get the descriptor handle of the IRD and // get some IRD values. SQLGetStmtAttr(g_hStmt, SQL_ATTR_IMP_ROW_DESC, (SQLPOINTER) &hIRD, sizeof(SQLHDESC), &cbIRD); // For statement-wide column attributes, any // descriptor record will do. You know that 1 exists, // so use it. SQLGetDescField(hIRD, 1, SQL_CA_SS_NUM_COMPUTES, (SQLPOINTER) &nComputes, SQL_IS_INTEGER, &cbIRD); if (nSet == 0) { SQLINTEGER nOrderID; printf_s("Normal result set.\n"); for (nCol = 0; nCol < nCols; nCol++) { SQLGetDescField(hIRD, nCol+1, SQL_CA_SS_COLUMN_ORDER, (SQLPOINTER) &nOrderID, SQL_IS_INTEGER, &cbIRD); if (nOrderID != 0) { printf_s("Col in ORDER BY, pos: %ld", nOrderID); } printf_s("\n"); } printf_s("\n"); } else { PCOMPUTEBYLIST pByList; SQLSMALLINT nBy; SQLINTEGER nColID; printf_s("Computed result set number: %lu\n", nSet); SQLGetDescField(hIRD, 1, SQL_CA_SS_COMPUTE_BYLIST, (SQLPOINTER) &pByList, SQL_IS_INTEGER, &cbIRD); if (pByList != NULL) { printf_s("Clause ordered by columns: "); for (nBy = 0; nBy < pByList->nBys; ) { printf_s("%u", pByList->aByList[nBy]); nBy++; if (nBy == pByList->nBys) { printf_s("\n"); } else { printf_s(", "); } } } else { printf_s("Compute clause set not ordered.\n"); } for (nCol = 0; nCol < nCols; nCol++) { SQLGetDescField(hIRD, nCol+1, SQL_CA_SS_COLUMN_ID, (SQLPOINTER) &nColID, SQL_IS_INTEGER, &cbIRD); printf_s("ColumnID: %lu, nColID); } printf_s("\n"); } if (SQLMoreResults(g_hStmt) == SQL_SUCCESS) { // Determine the result set indicator. SQLGetDescField(hIRD, 1, SQL_CA_SS_COMPUTE_ID, (SQLPOINTER) &nSet, SQL_IS_INTEGER, &cbIRD); } ``` ## See Also [SQLGetDescField Function](http://go.microsoft.com/fwlink/?LinkId=59351) [ODBC API Implementation Details](../../relational-databases/native-client-odbc-api/odbc-api-implementation-details.md)