Is there a way of generating random base36 identifiers with a defined character count in SQL Server?
I have searched and found many examples of converting base 36 to int and vice versa, but not for randomly generating unique IDs.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This solution a bit verbose but works and can easily be adapted to a variety of requirements. Here’s some sample output:
Note that you need to create a view to wrap the use of RAND which is not allowed inside a UDF. So this solution needs two db objects, a view and a udf.