Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Insert into zzzzsys_user from another table

Questions related to using nuBuilder Forte.
Post Reply
miasoft
Posts: 156
Joined: Wed Dec 23, 2020 12:28 pm
Location: Russia, Volgograd
Has thanked: 32 times
Been thanked: 7 times
Contact:

Insert into zzzzsys_user from another table

Unread post by miasoft »

I have several hundred records in client table (from my prev desktop program).I would like to add these entries in zzzzsys_user. Only some fields:
login, password, department. How can I do it programatically (not manual)? Is it possible?
Wbr, miasoft.
kev1n
nuBuilder Team
Posts: 4302
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Insert into zzzzsys_user from another table

Unread post by kev1n »

You could also import a csv file with phpMyAdmin and create a trigger to generate a unique primary key and md5 hash the password, e.g. like

Code: Select all

CREATE TRIGGER insert_user 
BEFORE INSERT ON zzzzsys_user 
FOR EACH ROW SET 
NEW.zzzzsys_user_id = Left(Replace(UUID(),'-',''),25), 
NEW.sus_login_password = MD5(NEW.sus_login_password)
After the import, the trigger should be removed again so that there are no problems when users are created manually.
miasoft
Posts: 156
Joined: Wed Dec 23, 2020 12:28 pm
Location: Russia, Volgograd
Has thanked: 32 times
Been thanked: 7 times
Contact:

Re: Insert into zzzzsys_user from another table

Unread post by miasoft »

Thanks! The trigger works fine!
Wbr, miasoft.
Post Reply