Beruflich Dokumente
Kultur Dokumente
Part I – Basics
Kent Agerlund - 7th September 2008
I often hear customers and students complaining about the complexity of creating reports. Statements like;
“the database is a mystery” and “I am not a SQL expert. I agree, the database can be a mystery. But using the
proper tools and some very basic SQL skills you will be able to create powerful reports.
I will post 4 parts explaining the basics and how to build a few reports.
Views:
Reports are based on SQL views. A view is basically just a query joining one or more tables. Knowing a few
basics of the naming standard I very helpful:
Conditionals:
SQL uses well-known conditionals like:
<
>
=
AND
OR
NOT
DISTINCT
LIKE
TOP
Aggregate Functions:
GROUP BY
COUNT
MIN
MAX
Part II – Creating first Report
In this part I will walk you through the creation of a report in SQL Server Managmenet Studio. The report will
show all clients with SMS 2003 Toolkit installed.
Click Next.
Click Next.
Click Next.
Click Next.
Click Close.
Select Count in the second Model() column. Your SQL statement should
look like this:
When you are working with prompts in reports there is a few things you need to know first.
V_R_SYSTEM
V_GS_PC_BIOS
V_GS_COMPUTER_SYSTEM
The Result
Copy the SQL statement, open the Config Mgr. console, create a new
report and paste the SQL statement as explained in post II.
If you finish the report wizard, you will have a useful report with basic
hardware information.
Now you need to create the prompt and the select statement. We start
by creating the prompt, click on the Prompts button.
In the Prompts dialog box click on the yellow starburst icon (to create
a new prompt)
In the Name column type the variable name (this is the name we will
use later in the Where statement). In my example I type
BiosSerialNumber
In prompt text type the text that will be displayed for the end user. I
typed Select bios serial number
Next we will provide a SQL statement which will fill the list of bios
serial numbers.
Click Provide a SQL statement and click the Edit SQL Statement
button
Click OK
Click OK
Click OK
Click Yes
By now you should be back in the SQL statement, navigate to the end
and type
WHERE (dbo.v_GS_PC_BIOS.SerialNumber0 =
@BiosSerialNumber)
When you click Values you will run the SQL statement from the
prompt
Click Display
Nice report