Retrieving Column Information - OLE DB Provider for Teradata

OLE DB Provider for Teradata User Guide

Product
OLE DB Provider for Teradata
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2498
Product Category
Teradata Tools and Utilities

Retrieving Column Information

Because the command is not prepared, the consumer must wait until after command execution to retrieve information about any columns returned. The consumer must query the IColumnsInfo and IColumnsRowset interfaces from the Rowset object. If the consumer queries these interfaces from the Command object after execution, any method the consumer calls returns the DB_E_NOTPREPARED error code.

Retrieving Column Information

However, if it is necessary to process column information before executing the SQL, the consumer can perform the following steps, which are in addition to the tasks listed previously in “Required Actions Before ICommand::Execute” on page 66.

1 Prepare the command using ICommandPrepare::Prepare.

2 Query either IColumnsInfo or IColumnsRowset from the Command Object.

3 Retrieve the column information using methods contained in IColumnsInfo or IColumnsRowset retrieved in step 2.

4 Unprepare the command using ICommandPrepare::UnPrepare.

Note: It is important to unprepare the command prior to execution. If this is not done, ICommand::Execute returns the error code DB_E_PARAMNOTOPTIONAL.