|
WQL Operators |
|
The Windows Management Instrumentation Query Language (WQL) supports a set of standard operators that are used in the WHERE clause of a SELECT statement, as follows.
There are a few additional WQL-specific operators: IS, IS NOT, ISA, and LIKE. The IS and IS NOT operators are valid in the WHERE clause only if the constant is NULL. For example, the following queries are valid:
SELECT * FROM Win32_LogicalDisk WHERE FileSystem IS NULL SELECT * FROM Win32_LogicalDisk WHERE FileSystem IS NOT NULL
The following queries show invalid uses of IS and IS NOT:
SELECT * FROM Win32_LogicalDisk WHERE DriveType IS 5 SELECT * FROM Win32_LogicalDisk WHERE FileSystem IS NOT "NTFS"
The ISA operator is used in the WHERE clause of data and event queries to test embedded objects for a class hierarchy. The ISA operator eliminates the need for keeping track of newly-derived classes when requesting a hierarchy of classes. When you use ISA, newly-created and existing subclasses of the requested class are automatically included in the result set.
The LIKE operator determines whether or not a character string matches a specified pattern. The specified pattern can contain exactly the characters to match, or it can contain meta characters. The following table lists the meta characters.
Because the underscore is a meta character, if the query target has an underscore, the "[]" escape characters must surround it. For example, you can query for all the classes that have a double underscore in the name.
To locate all classes with a double underscore in the name, you must escape both underscores with [] (square brackets), for example:
SELECT * FROM meta_class WHERE __CLASS LIKE "%[_][_]%"
Windows 2000 and Windows NT 4.0: The LIKE operator is not available.
|
