Client Management Suite

 View Only
  • 1.  What table would I find a user's manager's name?

    Posted Jun 21, 2012 11:43 AM

    running: SMP 7.1. SP2 Rollup 4

    I'm trying to find the tables/views that contains a user's manager's name. I am able to find this information in the resource manager for users however I'm trying to write a SQL query that includes this information on a separate report.  I really don't know where to start. 

     

    Thanks!



  • 2.  RE: What table would I find a user's manager's name?

    Posted Jun 21, 2012 01:07 PM

    The user's manager is a resource association so you need to join to the ResourceAssociation table. This is a sample query to pull user name with manager:

     

    select
    vu.[Given Name] + ' ' + vu.Surname as 'User Name'
    , ISNULL(man.Name, 'No Manager') as 'manager'
    from
    vUser vu
    LEFT JOIN
          (SELECT ra.ParentResourceGuid, it.Name, ra.ChildResourceGuid
          FROM ResourceAssociation ra LEFT JOIN vItem it
          ON ra.ChildResourceGuid = it.Guid
          WHERE ra.ResourceAssociationTypeGuid =
    '049C633F-8413-42AE-93EA-F4EB7EDAFC65') man
    on man.ParentResourceGuid = vu.Guid

     

    I LEFT JOIN with parantheses to make sure that my results include user names and managers (if any). If you don't left join then the query will only returns users who have managers, fYI.



  • 3.  RE: What table would I find a user's manager's name?
    Best Answer

    Posted Jul 01, 2012 01:21 AM

    That worked really well for me.  Thanks very much for the direction!