In this example I explain how to use the prompt function. I anticipate that you already by now know how to create the report in Configuration Manager and how to start SQL Server Management Studio. This report will list some basic hardware details with a prompt on the Bios Serial number. I am creating the first part of the report in SQL server 2008 Studio Manager, and the prompt in the Config Mgr. console.
When you are working with prompts in reports there is a few things you need to know first.
The following views are used in this example:
V_R_SYSTEM
V_GS_PC_BIOS
V_GS_COMPUTER_SYSTEM
|
I’ve started SQL Server Management Studio, navigated to the SMS_Sitecode database, and created a new View. For information about those steps please refer to Part II of this post.
|
|
Select V_GS_Computer_System, V_R_SYSTEM, V_GS_PC_BIOS click Add and Close.
|
|
From V_R_System drag the column RessourceID onto the RessourceID column onto the V_GS_Computer_System view.
|
|
From V_R_System drag the column RessourceID onto the RessourceID column onto the V_GS_PC_BIOS view.
|
|
From V_R_SYSTEM select, Name() From V_GS_PC_BIOS select, Name(), Releasedate(), SerialNumber() From V_GS_COMPUTER_SYSTEM select, Manufacturer0, Model0, NumberOfProcessors0
In the V_GS_PC_BIOS.Name() Alias. column type Bios Name
|
|
The SQL statement:
SELECT dbo.v_R_System.Name0, dbo.v_GS_COMPUTER_SYSTEM.Manufacturer0, dbo.v_GS_COMPUTER_SYSTEM.Model0, dbo.v_GS_COMPUTER_SYSTEM.NumberOfProcessors0, dbo.v_GS_PC_BIOS.Name0 AS [Bios Name], dbo.v_GS_PC_BIOS.ReleaseDate0, dbo.v_GS_PC_BIOS.SerialNumber0 FROM dbo.v_R_System INNER JOIN dbo.v_GS_COMPUTER_SYSTEM ON dbo.v_R_System.ResourceID = dbo.v_GS_COMPUTER_SYSTEM.ResourceID INNER JOIN dbo.v_GS_PC_BIOS ON dbo.v_R_System.ResourceID = dbo.v_GS_PC_BIOS.ResourceID
|
|
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 |
|
In the SQL statement box type: Select distinct SerialNumber0 From v_GS_PC_BIOS
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)
Notice: You could also type @BiosSerialNumber in the criteria column in SQL Server Management Studio.
Click OK and save the report. |
|
When you run the report it should look like this. |
|
When you click Values you will run the SQL statement from the prompt |
|
Click Display |
|
Nice report 🙂 |
Kent,
these series of articles are absolutely amazing. Thank you so much for taking the time to post these.
Kent, Thanks for the help…
Do you know if it is possible to select multiple values inside a prompt so that a report can bring back multiple records? For example, I want the workstation name, user, serial number, ad site and last bootup time for “computer1; computer2; computer3; computer4; computer5”.
I guess my idea would be if a user adds multiple machine names seperated by a “;” the report will bring back those machines.