Posted on 周四 21 十月 2021

Create Custom Report - SQL Query



For example, I need a custom report which shows installed software in all computers, the report column will have:

  • Computer Name

  • Software Name

  • Software Version

  • Software Publisher

On database server, open SSMS

Use SCCM database, expand tables, and we need this table “dbo.INSTALLED_SOFTWARE_DATA”.

1

In this table, we can see ProductName, ProductVersion and Publisher, but there’s no computer name. Computer name exists in the table “Computer_System_DATA” in column “Name00”.

2

We’ll use MachineID to join these two tables.

3

So the query is like:

SELECT 
       [Name00] as [Computer Name]
      ,[ProductName00] as [Software Name]
      ,[ProductVersion00] as [Software Version]
      ,[Publisher00] as [Software Publisher]

  FROM [CM_PS1].[dbo].[INSTALLED_SOFTWARE_DATA] as T1
  inner join
  [CM_PS1].[dbo].[Computer_System_DATA] as T2
  on T1.MachineID = T2.MachineID



4