Search code examples
dqldocumentum

DQL match new users groups to existing users groups


I'm trying to use DQL to match a new user groups to an existing users. I've tried the below which doesn't return a error but also doesn't seem to work.

UPDATE dm_group objects append users_names='user2' where group_name in (SELECT DISTINCT group_name FROM dm_group WHERE ANY i_all_users_names='user1');

Solution

  • UPDATE dm_group OBJECTS 
    APPEND users_names = ‘user2’ 
    WHERE group_name IN 
    (SELECT group_name FROM dm_group WHERE ANY users_names IN (‘user1’))
    

    If you want to add users to single group you should go with this DQL

    ALTER GROUP <group_name>
    ADD (SELECT user_name FROM dm_user WHERE user_name IN (‘user1’, ‘user2’))
    

    I haven't tried DQLs but composed them based on this page. They should work though, if there is a problem please comment my answer.