Pages

Wednesday, July 25, 2012

WQL (SQL for WMI)


The WMI Query Language (WQL) is a subset of the American National Standards Institute Structured Query Language (ANSI SQL)—with minor semantic changes. The following table lists the WQL keywords.
WQL keywordMeaning
ANDCombines two Boolean expressions, and returns TRUE when both expressions are TRUE.
ASSOCIATORS OFRetrieves all instances that are associated with a source instance.
Use this statement with schema queries and data queries.
__CLASSReferences the class of the object in a query.
Windows NT 4.0 and Windows Me/98/95:  Not available.
FROMSpecifies the class that contains the properties listed in a SELECT statement. Windows Management Instrumentation (WMI) supports data queries from only one class at a time.
GROUP ClauseCauses WMI to generate one notification to represent a group of events.
Use this clause with event queries.
HAVINGFilters the events that are received during the grouping interval that is specified in the WITHIN clause.
ISComparison operator used with NOT and NULL. The syntax for this statement is the following:
IS [NOT] NULL
(where NOT is optional)
ISAOperator that applies a query to the subclasses of a specified class. For more information, see ISA Operator for Event Queries,ISA Operator for Data Queries, and ISA Operator for Schema Queries.
KEYSONLYUsed in REFERENCES OF and ASSOCIATORS OF queries to ensure that the resulting instances are only populated with the keys of the instances, which reduces the overhead of the call.
Windows 2000, Windows NT 4.0, and Windows Me/98/95:  Not available.
LIKEOperator that determines whether or not a given character string matches a specified pattern.
NOTComparison operator that use in a WQL SELECT query, for example:
SELECT * FROM meta_class WHERE NOT __class < "Win32" AND NOT __this ISA " Win32_Account"
NULLIndicates an object does not have an explicitly assigned value. NULL is not equivalent to zero (0) or blank.
ORCombines two conditions.
When more than one logical operator is used in a statement, the OR operators are evaluated after the AND operators.
REFERENCES OFRetrieves all association instances that refer to a specific source instance. Use this statement with schema and data queries. The REFERENCES OF statement is similar to the ASSOCIATORS OF statement. However, it does not retrieve endpoint instances; it retrieves the association instances.
SELECTSpecifies the properties that are used in a query.
TRUEBoolean operator that evaluates to -1 (minus one).
WHERENarrows the scope of a data, event, or schema query.
WITHINSpecifies a polling or grouping interval.
Use this clause with event queries.
FALSEBoolean operator that evaluates to 0 (zero).

Note  Using a WQL key word as an object name can result in a query that cannot be parsed—even when the query compiles without error.

Related topics

WQL Operators
WQL-Supported Date Formats
WQL-Supported Time Formats

No comments:

Post a Comment