Microsoft KB Archive/213173

From BetaArchive Wiki
Knowledge Base


SMS: Error When Using DISTINCT Keyword Inside Count Query in WQL

Article ID: 213173

Article Last Modified on 10/27/2006



APPLIES TO

  • Microsoft Systems Management Server 2.0 Standard Edition



This article was previously published under Q213173

SYMPTOMS

When you use the DISTINCT keyword inside of the COUNT function in a Web-Based Enterprise Management (WBEM) Query Language (WQL) query, an error message appears and it fails to run.

For example, if you run the following WQL query:

SELECT COUNT(DISTINCT CollectionID) from SMS_Collection
                

the following error message appears:

Failed to parse WQL stringSELECT COUNT(DISTINCT CollectionID) FROM SMS_Collection

The query should return a generic object with the number of collections as a property.

WORKAROUND

To resolve this problem, obtain the latest service pack for Systems Management Server version 2.0. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

288239 SMS: How to Obtain the Latest Systems Management Server 2.0 Service Pack


Using the same example, run the following query:

SELECT DISTINCT CollectionID from SMS_Collection
                

If you are doing this programmatically use the appropriate API. If you are using WBEMTEST, the number of objects are returned in the Query Result window.


Additional query words: prodsms smssql wql query

Keywords: kbnofix kbprb kbsms200presp4fix KB213173