Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/08/2024 06:54 AM
Hi,
We need to have username in the format 2 random Alphabets(Uppercase) and 5 Random Numbers.
Example:TK54768, YR28623
But Saviynt OOB generation rule doesn't support only Uppercase Alphabets.
Can someone please help us with a sample advance query to generate username in the required logic.
2 random Alphabets(Uppercase) and 5 Random Numbers
Solved! Go to Solution.
08/08/2024 07:31 AM
SELECT
CONCAT(
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
FLOOR(RAND() * 10),
FLOOR(RAND() * 10),
FLOOR(RAND() * 10),
FLOOR(RAND() * 10),
FLOOR(RAND() * 10)
) AS username;
08/12/2024 06:43 AM
08/12/2024 06:55 AM
SELECT
CONVERT(
CONCAT(
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 10) + 48),
CHAR(FLOOR(RAND() * 10) + 48)
) USING utf8mb4
) AS username;
08/14/2024 06:58 AM
Hi Rishi,
We modified the query to :
SELECT
CONVERT(
CONCAT(
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 26) + 65),
CHAR(FLOOR(RAND() * 10) + 48),
CHAR(FLOOR(RAND() * 10) + 48),
CHAR(FLOOR(RAND() * 10) + 48),
CHAR(FLOOR(RAND() * 10) + 48),
CHAR(FLOOR(RAND() * 10) + 48)
) USING utf8mb4
) AS username;
and it worked as per our requirement. Thanks for your help!