Quantcast
Viewing all articles
Browse latest Browse all 2638

Mass User Change

I would like to change all the users. Specifically, I would like to add the email address as a parameter. For one user at a time I can do this using ALTER USER. But for a mass user change, I decided I would need a complete procedure using the cursor. To that purpose I uploaded the user names and email addresses to a table I created: user_email.

 

 

CREATE PROCEDURE user_email()

LANGUAGE SQLSCRIPT AS

BEGIN

    DECLARE v_email   NVARCHAR(256) default '';

    DECLARE v_user    NVARCHAR(5000) default '';

    DECLARE CURSOR c_1  FOR

                   SELECT user, email FROM MYSCHEMA.USER_EMAIL;

    FOR cur_row AS c_1

               DO

        v_user = cur_row.user;

        ALTER USER v_user

                              SET PARAMETER

                              email address = cur_row.email;

    END FOR;

END;

 

 

Unfortunately, this does not work. I get a syntax error for the ALTER USER line  "USER is not supported".

 

This has left me baffeled. Any help will be much appreciated.

 

Cheers,

Martin


Viewing all articles
Browse latest Browse all 2638

Trending Articles