How Queries Are Processed
By Garth Jones
A question that comes up from time to time is about how to locate PCs that do not have a specific type of software installed.
A common mistake is to think that you need to use either Not Equal To or Not Like within a query. However, by using these operators in your query the end result will show every PC within System Center Configuration Manager. I will explain why this is true, but let’s first talk about how queries are processed.
Before looking at queries that contain Not Equal To or Not Like we need to understand what Equal To or Like means in a query. As a general rule, when a query is run a query will process each row within a view or a table.
For our example we will query to find all PCs with Microsoft Project 2010. Using the following table, let’s see how this query with the Equal To operator is processed. This table is comprised of 4 PCs and their add/remove program (ARP) details.
|1||Adobe Reader XI||Microsoft Project 2010||Visio 12||Adobe Reader X|
|2||Visio 12||CorelDraw||ITunes||Microsoft Project 2010|
|4||Microsoft Office 2013||Lotus123|
Remember, our main concern is to find all of the PCs with Microsoft Project 2010 installed.
1. Starting with PC1, the query will review each row to look for Microsoft Project 2010. The software is not found in any of PC1’s rows.
2. The process is repeated with PC2. This time Microsoft Project 2010 is found and PC2 is added to the result set.
3. The process is repeated with PC3. The software is not found in any rows for PC3.
4. The process is repeated with PC4. This time Microsoft Project 2010 is found in row 2 and PC4 is added to the result set.
5. Finally, the result set for the query will return PC2 and PC4.
Looking at the table above, this information is exactly what we expected to see in our result set.
Over my next five blog posts, I will explain how the Not Equal To query is processed and how to use a subselect query to locate PCs that do not have a specific type of software installed.