5. Console Reporting Links
In addition to the report viewing functionality
found under the ConfigMgr console’s Reporting subtree, Microsoft
provides a number of links throughout the console to reports relevant to
the task at hand. As an example, the Software Distribution home page
found under Configuration Manager -> Site Database -> Computer
Management -> Software Distribution presents links to several reports
related to software distribution. Perform the following steps to
configure the behavior of these links:
1. | Right-click
the System Center Configuration Manager -> Site Database node in the
Configuration Manager console tree, and choose Report Options.
|
2. | The
Report Options dialog box provides check boxes to use SRS for the
ConfigMgr console report links and to open reports in a new window. By
default, report links open inside the console window and use the classic
reporting engine. If you have multiple reporting points or reporting
services points, you can also use this dialog box to specify which site
systems to use when launching reports from the console. Figure 7 displays the Report Options dialog box.
|
6. Relational Database Concepts
The heart of each report is a Structured Query
Language (SQL) statement that retrieves data from the site database. SQL
is the standard language for managing and querying relational
databases. If you are not familiar with the basic concepts of relational
databases and the SQL language, it is worth taking some time to learn
about them. You don’t need to
be a SQL expert to administer ConfigMgr, but to get the most out of the
product, it helps to know a little SQL.
Database Tables
A relational database management system (RDBMS)
such as Microsoft SQL Server organizes data into logical storage
containers called tables. You can think of a table as being similar to a spreadsheet, with data arranged in rows and columns. Table 2 shows a simple example of a database table.
Table 2. A Database Table Showing Available Cars
Stock Number | Color | Body Style | Engine Type |
---|
12345 | Blue | Coupe | 4-Cyl |
12350 | Red | Convertible | V-6 |
12399 | Black | Sedan | V-6 |
12401 | Blue | Sedan | 4-Cyl |
Database Views
Database developers use views
to gather data from one or more tables and present that data to users.
Using views gives developers the ability to choose which data to make
available and how to arrange and format that data, without needing to
reorganize the underlying tables. For the purpose of developing reports,
views are essentially equivalent to tables. Microsoft provides an
extensive set of views in the Configuration Manager database. The
reports Microsoft provides in Configuration Manager are based on the
database views, and you should use these views wherever possible when
designing or customizing reports.
Caution: Working with the Site Server Database
Many ConfigMgr administrators already have
some degree of familiarity with the site server database, which is the
repository of all data used by ConfigMgr. Microsoft strongly suggests
using the look-but-don’t-touch approach, as direct modification of the
database is not supported and might render your site unusable.
Microsoft provides views to use when
developing queries and reports because the underlying table structure
might change from version to version, and even from one service pack to
another. Building queries that pull data directly from the base tables
is not recommended because those queries might not work in a future
version of ConfigMgr.
The Select Statement
The SQL language contains a rich set of
statements for manipulating data and managing databases. For reporting
purposes, it is necessary to look at only one statement of the SQL language,
the SELECT statement. The SELECT statement retrieves data from a
database.
In its most basic form, the SELECT statement looks like
SELECT select_list FROM table_source
Table_source specifies the database tables or views from which the data will be retrieved, and the select_list is the list of columns you want to retrieve. As an example, if the data presented in Table 18.2
were stored in a table named cars, you would use the following
statement to retrieve the stock number, color, and body style of the
available cars:
SELECT [stock number], color, [body style] FROM cars
Notice the column names containing spaces are
enclosed in square brackets []. The brackets also allow you to include
SQL reserved words in your column names if you choose to do so. The
preceding query would return all the data shown in Table 18.2 except the engine type.
The WHERE clause
You can limit the results of your SELECT
statement to rows meeting specific criteria by adding a WHERE clause to
your statement. As an example, the statement
SELECT [stock number], color, [body style] FROM cars WHERE [Engine Type] = 'V-6'
returns only the rows for cars with V-6 engines. Table 3 shows the results of this statement.
Table 3. The Result Set from the SELECT Statement Example
Stock Number | Color | Body Style |
---|
12350 | Red | Convertible |
12399 | Black | Sedan |
Table Joins
Database platforms such as Microsoft SQL Server are called relational databases
because they take advantage of relationships in the data to reduce
redundant storage and provide more flexibility in working with the data.
If the cars in the cars sample table are rental vehicles, for example,
you can use a separate table to store the rental history of each vehicle
without duplicating all the information in the cars table each time a
vehicle is rented. Table 4 shows a portion of the rentals table.
Table 4. Rentals Table Entries – Week Ending 11/22/2008
Stock Number | CustNo | Date | MilesOut | MilesIn |
---|
12345 | 7741 | 11/16/2008 | 12105 | 12200 |
12399 | 8806 | 11/17/2008 | 21241 | 21249 |
12345 | 14101 | 11/19/2008 | 12200 | 12233 |
12350 | 14102 | 11/19/2008 | 8888 | 8903 |
12399 | 9364 | 11/20/2008 | 21249 | 21304 |
12401 | 14103 | 11/21/2008 | 24808 | 24831 |
Now suppose you want to see the rental
information for blue cars for the week ending 11/22/2008. Use the
following SQL statement to retrieve that information, using both tables:
SELECT c.[stock number], c.[body style], r.CustNo AS [Customer Number], r.[Date],
(r.MilesOut – r. MilesIn) AS [Miles Driven]
FROM cars c INNER JOIN rentals r ON cars.[stock number] = rentals.[stock number]
WHERE c.color = 'Blue' AND r.[Date] BETWEEN '11/16/2008' AND '11/23/2008'
The key to this
statement is the INNER JOIN clause, which causes this SELECT statement
to pull only the data from the rows in the two tables where the stock
numbers match. The results of this statement are displayed in Table 5.
Table 5. Blue Car Rentals–Week Ending 11/22/2008
Stock Number | Customer Number | Body Style | Date | Miles Driven |
---|
12345 | 7741 | Coupe | 11/16/2008 | 95 |
12345 | 14101 | Coupe | 11/19/2008 | 33 |
12401 | 14103 | Sedan | 11/21/2008 | 23 |