Hi ALL
Im trying to write a new sql query to generate a sccm report based on deployment id and machine id or host name.. the report is as follows..
im getting some data after 5min in sql db that too multiple results, but not in sccm reporting.. please help me..
main query:
declare @DeploymentLocalID as int
declare @RscID as int
select @DeploymentLocalID=AssignmentID from v_CIAssignment where Assignment_UniqueID=@DEPLOYMENTID and UpdateAssignment=1
select Assignment_UniqueID as DeploymentID,
AssignmentName as DeploymentName
from v_CIAssignment where AssignmentID=@DeploymentLocalID
select @RscID=ResourceID from v_R_System where ((Name0 = @MachineName) and (Active0 = 1));
select catinfo.CategoryInstanceName as Vendor0,
ArticleID as ArticleID,
BulletinID as BulletinID,
Title as Title,
Approved = case when col.CollectionID is not null then '*' else '' end,
NumPresent as Installed,
NumMissing as Required,
NumNotApplicable as NotRequired,
NumUnknown as Unknown,
NumTotal as Total,
PCompliant=case when NumTotal<>0 then CAST((NumPresent+NumNotApplicable)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
PNotCompliant=case when NumTotal<>0 then CAST((NumMissing)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
PUnknown=case when NumTotal<>0 then CAST((NumUnknown)*100.0/NumTotal as numeric(5,2)) else 0.0 end,
col.CollectionID,
UniqueUpdateID=ui.CI_UniqueID,
ctm.ResourceID
from v_CIAssignmentToCI cia
join v_UpdateInfo ui on cia.CI_ID = ui.CI_ID
join v_UpdateComplianceStatus css on ui.CI_ID=css.CI_ID
join (v_CICategories_All catall join v_CategoryInfo catinfo on catall.CategoryInstance_UniqueID = catinfo.CategoryInstance_UniqueID and catinfo.CategoryTypeName='Company')
on catall.CI_ID=ui.CI_ID
left join v_CITargetedCollections col on col.CI_ID=ui.CI_ID --and
col.CollectionID=@CollID
join v_UpdateSummaryPerCollection us on us.CI_ID=ui.CI_ID --and
us.CollectionID=@CollID
left join v_CITargetedMachines ctm on ctm.CI_ID=css.CI_ID and ctm.ResourceID = @RscID
left join (
select atc.CI_ID, Deadline=min(a.EnforcementDeadline) from v_CIAssignment a
join v_CIAssignmentToCI atc on atc.AssignmentID=a.AssignmentID
group by atc.CI_ID) cdl on cdl.CI_ID=css.CI_ID
where cia.AssignmentID=@DeploymentLocalID AND css.ResourceID = @RscID
prompts:
deployment id:
begin
if (@__filterwildcard = '')
select
cia.Assignment_UniqueID as DeploymentID , cia.AssignmentName as DeploymentName
from v_CIAssignment cia
where cia.UpdateAssignment=1
order by AssignmentName
else
select
cia.Assignment_UniqueID as DeploymentID , cia.AssignmentName as DeploymentName
from v_CIAssignment cia
where cia.UpdateAssignment=1
and Assignment_UniqueID like @__filterwildcard or AssignmentName like @__filterwildcard
order by AssignmentName
end
machine id:
begin
if (@__filterwildcard = '')
select distinct Name0 from v_R_System WHERE isnull(Obsolete0,0)<>1 order by Name0
else
select distinct Name0 from v_R_System
WHERE Name0 like @__filterwildcard
and isnull(Obsolete0,0)<>1 order by Name0
end