Created
January 12, 2016 08:54
-
-
Save ppolyzos/df6d77360732a3c68106 to your computer and use it in GitHub Desktop.
TSQL: Generate Random String of desired length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DesiredLength AS INT = 10; | |
select Lower(substring(replace(newID(), '-', ''), cast(RAND() * (31 - @DesiredLength) AS INT), | |
@DesiredLength)) AS randomString; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment