Random alphanumeric generation:
DECLARE @letters char(36) = 'abcdefghijklmnopqrstuvwxyz0123456789'
SELECT CONCAT(
SUBSTRING(@letters, CONVERT(INT,(ROUND(RAND(CAST(NEWID() AS VARBINARY)) * 36,0,-1))),1),
SUBSTRING(@letters, CONVERT(INT,(ROUND(RAND(CAST(NEWID() AS VARBINARY)) * 36,0,-1))),1),
SUBSTRING(@letters, CONVERT(INT,(ROUND(RAND(CAST(NEWID() AS VARBINARY)) * 36,0,-1))),1),
SUBSTRING(@letters, CONVERT(INT,(ROUND(RAND(CAST(NEWID() AS VARBINARY)) * 36,0,-1))),1))
;
GO 100
/*
2xfs
3uqv
plpv
...
*/
Reference blog:
Kalman Toth Database & OLAP Architect SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012
No comments:
Post a Comment