Insert into zzzzsys_user from another table

Questions related to using nuBuilder Forte.

Insert into zzzzsys_user from another table

Unread postby miasoft » Sat Apr 10, 2021 2:17 pm

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.
miasoft
 
Posts: 75
Joined: Wed Dec 23, 2020 8:58 pm

Re: Insert into zzzzsys_user from another table

Unread postby kev1n » Sat Apr 10, 2021 2:42 pm

kev1n
nuBuilder Team
 
Posts: 1704
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Insert into zzzzsys_user from another table

Unread postby kev1n » Sun Apr 11, 2021 4:52 am

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.
kev1n
nuBuilder Team
 
Posts: 1704
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Insert into zzzzsys_user from another table

Unread postby miasoft » Sun Apr 11, 2021 4:17 pm

Thanks! The trigger works fine!
Wbr, miasoft.
miasoft
 
Posts: 75
Joined: Wed Dec 23, 2020 8:58 pm


Return to General

Who is online

Users browsing this forum: No registered users and 12 guests