Migrate local group memberships between directories (SQL)

Jess Beitler July 18, 2019

There is a KB article titled "Migrate local group memberships between directories" (https://confluence.atlassian.com/jirakb/migrate-local-group-memberships-between-directories-289277867.html) and it gives the MySQL query to output the needed CSV file for migrating groups between directories (step 1). Is anyone able to translate this MySQL into SQL that can be used on Microsoft SQL Server? Or does anyone know how the CSV should be formatted so I can populate it manually? Thanks!

 

SELECT cu.lower_user_name, cg.lower_group_name 
  FROM cwd_user cu 
      JOIN cwd_membership cm ON cu.id=cm.child_id 
      JOIN cwd_group cg ON cm.parent_id=cg.id 
   WHERE cu.directory_id=<souce_directory_id> AND cg.directory_id=<souce_directory_id>
      INTO OUTFILE '/tmp/outfile.csv'
         FIELDS TERMINATED BY ','
         ENCLOSED BY ''
         LINES TERMINATED BY '\n';

 

0 answers

Suggest an answer

Log in or Sign up to answer