ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Change User Profile Text Description via SQL...?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change User Profile Text Description via SQL...?

    I need to mass change part of the text description on a bunch of user profiles...

    I can output all user profiles to a file and then programmatically loop through and do a CHGUSRPRF to replace the specific characters of the text description that I need to update for each user profile that meets my criteria.

    But is there a better way? Can I somehow use SQL?

  • #2
    In IBM i Services, there's a view that will let you retrieve information about a single user profile.

    The USER_INFO_BASIC view contains information about user profiles.


    I would be surprised if you can use this to change a user profile.

    I didn't see a service to return a list of user profiles. That doesn't mean there isn't one.

    Comment


    • #3
      If you're on a recent Technology Refresh, you could combine the view that Ted mentions with the QCMDEXC scalar function, described here:

      New QCMDEXC scalar functions allows me to execute CL commands from within SQL statements, such as the Select statement

      Comment


      • #4
        I used SQL to identify the user profiles to target (using QSYS2.USER_INFO) and to decide the new text descriptions for each one, and wrote them to a table. Then I wrote a CLLE to loop through the table and change the text using CHGUSRPRF. It was short and very easy.

        But I like the QCMDEXC scalar function Martin mentions above and it looks like I could have used that to do it all in the SQL statement. Thanks for posting the link to that article!

        Comment

        Working...
        X