DECLARE @DesiredLength AS INT = 10;
SELECT Lower(substring(replace(newID(), '-', ''), cast(RAND() * (31 - @DesiredLength) AS INT),
                       @DesiredLength)) AS RandomString;

 

Categorized in:

Tagged in: