SELECT Statement for Schema Queries

Schema data queries use the SELECT statement with a syntax similar to that for data queries. The difference is the use of a special class called "meta_class", which identifies the query as a schema query.

The following example requests all class definitions that are within the current namespace.


SELECT * FROM meta_class

Schema queries only support "*". To narrow the scope of the definitions returned, a provider can add a WHERE clause that specifies a particular class.

The following example shows how to add a WHERE clause to specify a particular class.


SELECT * FROM meta_class WHERE __this ISA "Win32_LogicalDisk"

The special property called __this identifies the target class for a schema query. Note that the ISA operator must be used with the __this property to request definitions for the subclasses of the target class. The preceding query returns the definition for the Win32_LogicalDisk class and definitions for all of its subclasses.

The following example shows how to request a class definition for a single class by using the __Class system property.


SELECT * FROM meta_class WHERE __Class = "Win32_LogicalDisk"

This query is equivalent to calling the IWbemServices::GetObject or the IWbemServices::GetObjectAsync method with the object path parameter set to "Win32_LogicalDisk".

 

 

Show:
© 2014 Microsoft. All rights reserved.