DB2DataReader.GetSchemaTable Method
Returns a DataTable that describes the column metadata of the DB2DataReader.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Function GetSchemaTable() As DataTable
[C#]
public DataTable GetSchemaTable();
[C++]
public: DataTable* GetSchemaTable();
[JScript]
public function GetSchemaTable() : DataTable;
Return value
A DataTable that describes the column metadata.
Exceptions
Exception type | Condition |
---|---|
InvalidOperationException | The DB2®DataReader is closed. |
Remarks
The GetSchemaTable method returns metadata about each column in the following order.
Field name | Description |
---|---|
ColumnName | The name of the column if it can be determined; this name might not be unique. The name always reflects the most recent name of the column in the current view or command text. If the column name cannot be determined, a null value is returned. |
ColumnOrdinal | The ordinal of the column. This value is zero for the bookmark column of the row, if any. Other columns are numbered starting with 1. This field cannot contain a null value. |
ColumnSize | The maximum possible length of a value in the column. For columns that use a fixed-length data type, this value is the size of the data type. |
NumericPrecision | If the Db2® Data Type is a numeric data type, the maximum precision of the column; otherwise, null. |
NumericScale | If the Db2 Data Type is decimal, the number of digits to the right of the decimal point; otherwise, null. |
DataType | A data type that maps to the Db2 Data Type. |
ProviderType | The Db2Type enumeration. |
IsLong | true if the column contains
a binary large object (BLOB) that contains very long data. |
AllowDBNull | true if the consumer
can set the column to a null value or if the driver cannot determine
whether the consumer can set the column to a null value; otherwise, false .
A column can contain a null value, even if it cannot be set to a null
value. |
IsReadOnly | true if the column cannot
be modified; otherwise, false . |
IsRowVersion | Set if the column contains a persistent row identifier that cannot be written to. |
IsUnique | true or false ,
defined as follows:
|
IsKey | true or false ,
defined as follows:
|
IsAutoIncrement | true if the column assigns
values to new rows in fixed increments; otherwise, false .
The default for this column is false . |
BaseSchemaName | The name of the schema in the database that contains the column if the base schema name can be determined. The value of BaseSchemaName is a null value if the base schema name cannot be determined. The default for this column is a null value. |
BaseCatalogName | The name of the catalog in the database that contains the column if the catalog name can be determined. The value of BaseCatalogName is a null value if the base catalog name cannot be determined. The default for this column is a null value. |
BaseTableName | The name of the table or view in the database that contains the column if the name of the table can be determined. The value of BaseTableName is a null value if the base table name cannot be determined. The default for this column is a null value. |
BaseColumnName | The name of the column in the database, if possible. This name might be different than the column name returned in the ColumnName column if you used an alias. The value of the BaseColumnName column is a null value if the base column name cannot be determined or if the rowset column is derived from, but is not identical to, a column in the database. The default for the BaseColumnName column is a null value. |
ModuleName |
|
A row is returned for every column in the result set.
DB2CommandBuilder needs to correctly identify the primary keys of a table to work correctly. If the BaseTableName column is not returned for every column in the results of a query, IBM® Data Server Provider for .NET tries to parse the SQL statement to find the table names involved in the query. This approach works with UPDATE, INSERT, DELETE and simple SELECT statements but not with stored procedures or SELECT statements that are based on joins. If some or all of the schema information is missing from a table, the DB2CommandBuilder does not work correctly because it does not have enough schema information to automatically generate the correct INSERT, UPDATE, or DELETE statements.