Page 1 of 1
Insert into zzzzsys_user from another table
Posted: Sat Apr 10, 2021 6:47 am
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?
Re: Insert into zzzzsys_user from another table
Posted: Sat Apr 10, 2021 7:12 am
by kev1n
Re: Insert into zzzzsys_user from another table
Posted: Sat Apr 10, 2021 9:22 pm
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.
Re: Insert into zzzzsys_user from another table
Posted: Sun Apr 11, 2021 8:47 am
by miasoft
Thanks! The trigger works fine!