Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SQLColumns (Extended Level 1)

The SQLColumns function returns a list of column names in specified tables. The information is returned in a result set on the specified hStmt handle.

Note   For more information about support or requirements for installation on a specific operating system, see Operating System Availability of WMI Components.

For example, to get information on the columns in TcpConnectionTable on the DatabaseName device (represented by a database), the client invokes SQLColumns:

SQLColumns (hstmt, "DatabaseName", SQL_NTS,  // qualifier
  NULL, 0,                                   // owner
  "TcpConnectionTable", SQL_NTS,             // table
  "%",SQL_NTS);                              // all columns

The following table lists the information returned in a rowset.

ColumnData typeDescription
TABLE_QUALIFIER_NAMEVarChar (128)Table qualifier. This corresponds to the database name.
TABLE_OWNERVarChar (128)Not used.
COLUMN_NAMEVarChar (128)Column name (a WMI property name).
TYPE_NAMEVarChar (128), not nullableData type name. This is a data source dependent type name.
PRECISIONIntegerPrecision of the column in the SNMP Module Information Repository (SMIR).
LENGTHIntegerLength of the column.
SCALESmallIntScale of the column.
RADIXSmallIntRadii of the column.
NULLABLESmallInt, not nullableIndicates whether the column is nullable.
REMARKSVarChar (254)Description of the column.
ATTRIBUTESLongVarChar (16384)Column metadata.


For a description of these terms, see the table in Mapping WMI to ODBC.

As can be observed from the preceding table, the WMI ODBC adapter extends the SQLColumns result set by an extra column. This extra column is used to return the column metadata.

The metadata is displayed in the following format.

[metadata name][ metadata value]
[metadata name][ metadata value]

For example, the following example shows actual column metadata.


If the metadata name or value contains a left or right square bracket ([ or ]), then two such symbols are used instead of one. For example, to show fr[ed]dy, the following is displayed.


Note  Some classes have properties that support a qualifier called Lazy. Properties that are marked with the Lazy qualifier require a lot of processor time and memory. WMI improves the performance of queries by not attempting to return the properties that are marked with the Lazy qualifier.

Because WQL queries that contain "lazy" properties might fail, properties that are marked with the Lazy qualifier are not returned by the SQLColumns function.



© 2014 Microsoft