Monday, March 14, 2016

Userful Queries

1) Query to find computer name for user

SELECT
v_R_System.name0,
v_R_System.user_name0


from
v_R_System
WHERE v_R_System.user_name0 = 'username'

2) how-many-clients-assigned-to-management-points

select UPPER(SUBSTRING(lastmpservername, 1, CHARINDEX('.', lastmpservername) -1 )) as 'Management Point',
count(lastmpservername) as 'Total Clients'
from v_CH_ClientSummary
group by lastmpservername

order by lastmpservername desc

2) how-many-clients-assigned-to-AD site

SELECT
    R.AD_Site_Name0,
    Count(SMS_Installed_Sites0) AS 'Count'
From
    v_R_System R
    JOIN v_RA_System_SMSInstalledSites SIS ON R.ResourceID = SIS.ResourceID

Group By

    R.AD_Site_Name0 

No comments:

Post a Comment