Declare @Total int Select @Total=count(*) From v_Add_Remove_Programs Where v_Add_Remove_Programs.DisplayName0 Like '@DisplayName' Select Distinct v_Add_Remove_Programs.DisplayName0 as [Software Product], Version0 as [Version], COUNT(v_GS_System.Name0) as [Count], Round(100.0*count(*)/@Total,1) as [Percentage] FROM v_Add_Remove_Programs Join v_GS_System ON v_Add_Remove_Programs.ResourceID = v_GS_System.ResourceID WHERE v_Add_Remove_Programs.DisplayName0 Like '@DisplayName' GROUP BY Version0, v_Add_Remove_Programs.DisplayName0 ORDER BY [Percentage] DESC Select Distinct v_GS_SYSTEM.Name0 as [Computer Name], v_Add_Remove_Programs.DisplayName0 as [Software Product], Version0 as [Version] FROM v_Add_Remove_Programs Join v_GS_SYSTEM ON v_Add_Remove_Programs.ResourceID = v_GS_SYSTEM.ResourceID WHERE v_Add_Remove_Programs.DisplayName0 Like '@DisplayName' GROUP BY v_GS_SYSTEM.Name0, Version0, v_Add_Remove_Programs.DisplayName0 ORDER BY [Version] DESC
If I remove the @DisplyaName variables and type in a product name sucha as:
= 'Microsoft Office Professional 2013" or something, it works fine. How can I get the @DisplayName variables to work for me?
Thanks