Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Advance Query for Username generation with Only Uppercase letters

SanjeetaRao
Regular Contributor
Regular Contributor

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

4 REPLIES 4

rushikeshvartak
All-Star
All-Star

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;


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak ,

The above logic created the below username:

[76, 73, 51, 55, 52, 51, 51]

SanjeetaRao_0-1723470181111.png

 

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;

 

rushikeshvartak_0-1723470929317.png

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

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!