If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

SQL for list of Cognos users and groups(10.2.2)

Started by aerick911, 25 Jan 2017 03:33:33 PM

Previous topic - Next topic

aerick911

I used to have a sql view that would list out all Cognos users as well as the groups they belonged to in Cognos 10.1.1

Since we've updated to Cognos 10.2.2 that view is busted. :)

Does anyone have a quick and dirty sql query that does this?

---previous sql---

--Parent Group, Name, ldap_id, last_name,first__name, email, user_id
WITH groups_unwrapped(parent_group_id, child_group_id, lvl) AS (SELECT rel.CMID AS parent_group_id, grp.CMID AS child_group_id, 0 AS lvl
                                                                                                                                    FROM      dbo.CMREFORD1 AS rel INNER JOIN
                                                                                                                                                      dbo.CMOBJECTS AS grp ON rel.REFCMID = grp.CMID
                                                                                                                                    WHERE   (grp.CLASSID IN (26, 54)) AND (rel.CMID NOT IN
                                                                                                                                                          (SELECT grp.CMID AS child_group_id
                                                                                                                                                           FROM      dbo.CMREFORD1 AS rel CROSS JOIN
                                                                                                                                                                             dbo.CMOBJECTS AS grp
                                                                                                                                                           WHERE   (rel.REFCMID = grp.CMID) AND (grp.CLASSID IN (26, 54))))
                                                                                                                                    UNION ALL
                                                                                                                                    SELECT rel.CMID AS parent_group_id, grp.CMID AS child_group_id, unwp.lvl + 1 AS Expr1
                                                                                                                                    FROM     dbo.CMREFORD1 AS rel INNER JOIN
                                                                                                                                                      dbo.CMOBJECTS AS grp ON rel.REFCMID = grp.CMID CROSS JOIN
                                                                                                                                                      groups_unwrapped AS unwp
                                                                                                                                    WHERE  (grp.CLASSID IN (26, 54)) AND (rel.CMID = unwp.child_group_id))
    SELECT DISTINCT
                      grp_unwrapped.parent_group_id, group_info.NAME AS group_name, user_info.ldap_id, user_info.last_name, user_info.first_name, user_info.email, user_info.user_id
    FROM     (SELECT parent_group_id, child_group_id, lvl
                      FROM      groups_unwrapped AS groups_unwrapped_1
                      UNION ALL
                      SELECT rel.CMID AS parent_group_id, rel.CMID AS child_group_id, 0 AS lvl
                      FROM     dbo.CMREFORD1 AS rel INNER JOIN
                                        dbo.CMOBJECTS AS grp ON rel.REFCMID = grp.CMID
                      WHERE  (grp.CLASSID IN (5)) AND (rel.CMID NOT IN
                                            (SELECT REFCMID AS child_group_id
                                             FROM      dbo.CMREFORD1 AS rel))) AS grp_unwrapped INNER JOIN
                      dbo.CMREFORD1 AS user_group_relation ON grp_unwrapped.child_group_id = user_group_relation.CMID INNER JOIN
                          (SELECT c33.CMID AS user_id, c33.NAME AS ldap_id, c1.SURNAME AS last_name, c1.GIVENNAME AS first_name, c1.EMAIL AS email, c1.OBJID
                           FROM      dbo.CMOBJPROPS1 AS c1 LEFT OUTER JOIN
                                             dbo.CMOBJPROPS33 AS c33 ON c33.CMID = c1.CMID
                           UNION
                           SELECT dbo.CMOBJPROPS1.CMID AS user_id, dbo.CMOBJPROPS33.NAME AS ldap_id, dbo.CMOBJPROPS1.SURNAME AS last_name,
                                             dbo.CMOBJPROPS1.GIVENNAME AS first_name, dbo.CMOBJPROPS1.EMAIL, dbo.CMOBJPROPS1.OBJID
                           FROM     dbo.CMOBJPROPS1 INNER JOIN
                                             dbo.CMOBJPROPS33 ON dbo.CMOBJPROPS1.CMID = dbo.CMOBJPROPS33.CMID) AS user_info ON
                      user_group_relation.REFCMID = user_info.user_id INNER JOIN
                          (SELECT dbo.CMOBJNAMES.CMID AS cmid, dbo.CMOBJNAMES.NAME, dbo.CMOBJECTS.CREATED AS created, dbo.CMOBJECTS.MODIFIED AS modified,
                                             dbo.CMOBJECTS.DISABLED AS disabled, dbo.CMOBJECTS.CLASSID
                           FROM      dbo.CMOBJECTS INNER JOIN
                                             dbo.CMOBJNAMES ON dbo.CMOBJECTS.CMID = dbo.CMOBJNAMES.CMID
                           WHERE   (dbo.CMOBJECTS.CLASSID IN (26, 54)) AND (dbo.CMOBJNAMES.MAPDLOCALEID = 24)) AS group_info ON
                      grp_unwrapped.parent_group_id = group_info.cmid
    WHERE  (1 = 1)

misscognos

I don't have SQL but this should be done through SDK.