Last Hardware inventory date for the systems that are assigned to a Site code

set @SMSSiteCode = (case when IsNULL(@SMSSiteCode,'')='' then '%' else @SMSSiteCode end)

SELECT DISTINCT SYS.Netbios_Name0, SYS.Operating_System_Name_and0,
  HWSCAN.LastHWScan, SWSCAN.LastScanDate, SWSCAN.LastCollectedFileScanDate, v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0
FROM v_R_System SYS
LEFT JOIN v_GS_LastSoftwareScan SWSCAN on SYS.ResourceID = SWSCAN.ResourceID
LEFT JOIN v_GS_WORKSTATION_STATUS HWSCAN on SYS.ResourceID = HWSCAN.ResourceID left join v_RA_System_SMSAssignedSites on v_RA_System_SMSAssignedSites.ResourceID = SYS.ResourceID where v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0 like @SMSSiteCode
Create a prompt with a variable name - SMSsitecode

begin
if (@__filterwildcard = '')
  select distinct SMS_Assigned_Sites0 as SMSSiteCode From v_RA_System_SMSAssignedSites
else
  select distinct SMS_Assigned_Sites0 as SMSSiteCode  from v_RA_System_SMSAssignedSites
    where ((SMS_Assigned_Sites0 like @__filterwildcard))
    order by SMS_Assigned_Sites0
end

0 comments:

Post a Comment