Click HERE to see how Saviynt Intelligence is transforming the industry. |
07/07/2024 12:24 AM
Hello all
need a help for generating the StemUserName according to the following conditions.All lower case, remove diacritics <firstname>.<lastname>[<xxx>] Limited to 20 characters, if necessary truncate last name ,Uniqueness, In case of duplicate, append 3 digits starting with 001 and incrementing as needed.
07/07/2024 12:06 PM - edited 07/07/2024 12:16 PM
Hi @priyag ,
Case when (select count(*) from users u where u.syatemusername like concat(lower(u.firstname),'.',substring(lower(u.lastname),1,20),'001')=0 then concat(lower(u.firstname),'.',substring(lower(u.lastname),1,20),'001')
Else
concat(lower(u.firstname),'.',substring(lower(u.lastname),1,20),(select substring_index(substring(u1.susystemusername,1,(length(u1.firstname)+length(substring(u1.lastname,1,20)),'@',1)+1 from users u1 where u1.systenusername like concat(u1.firstname,substring(u1.lastname,1,20))),'@abc.com') END
07/07/2024 07:21 PM
Refer