Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 3.58 KB

File metadata and controls

55 lines (43 loc) · 3.58 KB
title SQLDescribeCol | 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
SQLDescribeCol function
ms.assetid ffbf34c6-8268-434f-829a-82009a6cda59
caps.latest.revision 40
author JennieHubbard
ms.author jhubbard
manager jhubbard

SQLDescribeCol

[!INCLUDESNAC_Deprecated]

For executed statements, the [!INCLUDEssNoVersion] Native Client ODBC driver does not need to query the server to describe columns in a result set. In this case, SQLDescribeCol does not cause a server roundtrip. Like SQLColAttributeandSQLNumResultCols, calling SQLDescribeCol on prepared but not executed statements generates a server roundtrip.

When a [!INCLUDEtsql] statement or statement batch returns multiple result row sets, it is possible for a column, referenced by ordinal, to originate in a separate table or to refer to an entirely different column in the result set. SQLDescribeCol should be called for each set. When the result set changes, the application should rebind data values prior to fetching row results. For more information about handling multiple result set returns, see SQLMoreResults.

Column attributes are reported for only the first result set when multiple result sets are generated by a prepared batch of SQL statements.

For large value data types, the value returned in DataTypePtr is SQL_VARCHAR, SQL_VARBINARY, or SQL_NVARCHAR. A value of SQL_SS_LENGTH_UNLIMITED in ColumnSizePtr indicates that the size is “unlimited”.

Improvements in the database engine starting with [!INCLUDEssSQL11] allow SQLDescribeCol to obtain more accurate descriptions of the expected results. These more accurate results may differ from the values returned by SQLDescribeCol in previous versions of [!INCLUDEssNoVersion]. For more information, see Metadata Discovery.

SQLDescribeCol Support for Enhanced Date and Time Features

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

DataTypePtr ColumnSizePtr DecimalDigitsPtr
datetime SQL_TYPE_TIMESTAMP 23 3
smalldatetime SQL_TYPE_TIMESTAMP 16 0
date SQL_TYPE_DATE 10 0
time SQL_SS_TIME2 8, 10..16 0..7
datetime2 SQL_TYPE_TIMESTAMP 19, 21..27 0..7
datetimeoffset SQL_SS_TIMESTAMPOFFSET 26, 28..34 0..7

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

SQLDescribeCol Support for Large CLR UDTs

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

See Also

SQLDescribeCol Function
ODBC API Implementation Details