Quantcast
Channel: Configuration Manager 2007 Operating System Deployment forum
Viewing all articles
Browse latest Browse all 1063

Adding an OU column to a report.....

$
0
0

Does anyone know off the top of their head how to add and populate and OU column to the sql statement for a report?

declare @CI_ID int; select @CI_ID=CI_ID from v_ConfigurationItems where CIType_ID=9 and CI_UniqueID=@AuthListID

declare @CollCount int, @NumClients int; select @CollCount = count(*), @NumClients=isnull(sum(cast(IsClient as int)), 0) from v_ClientCollectionMembers ccm where ccm.CollectionID=@CollID

select 
CollectionName=vc.Name, 
NumberInCollection=@CollCount,
NonClients=@CollCount-@NumClients,  
PComputers=convert(numeric(5,2), (@CollCount-@NumClients)*100.00 / isnull(nullif(@CollCount, 0), 1))
from v_Collection vc
where vc.CollectionID=@CollID

select 
CollectionID=@CollID,
Status=sn.StateName,
NumberOfComputers=count(*),
PComputers=convert(numeric(5,2), (isnull(count(*), 0)* 100.00 / isnull(nullif(@CollCount, 0), 1))),
AuthListID=@AuthListID
from v_ClientCollectionMembers cm
join v_UpdateListStatus_Live cs on cs.CI_ID=@CI_ID and cs.ResourceID=cm.ResourceID
left join v_StateNames sn on sn.TopicType=300 and sn.StateID=isnull(cs.Status, 0)
where cm.CollectionID=@CollID
group by sn.StateName
order by count(*) desc


Viewing all articles
Browse latest Browse all 1063

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>