Last active
December 23, 2015 23:49
-
-
Save marsen/6712356 to your computer and use it in GitHub Desktop.
Auto Gen Random Keys by MSSQL
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 @start INT = 1; | |
DECLARE @end INT = 50; | |
WITH #KEYS AS ( | |
SELECT @start AS Number, REPLACE(LEFT(NEWID(), 18), '-', '') AS [KEY] | |
UNION ALL | |
SELECT Number + 1, REPLACE(LEFT(NEWID(), 18), '-', '') AS [KEY] | |
FROM #KEYS | |
WHERE Number < @end | |
) | |
SELECT * FROM #KEYS OPTION (MAXRECURSION 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment