Sql 密码生成器 - 8 个字符,上下并包括一个数字

2021-09-10 00:00:00 sql tsql sql-server

我需要在 TSQL 中创建一个新密码,该密码必须为 8 个字符 (a-z),其中必须包括大写和小写字符以及至少一个数字.

I need to create a new password in TSQL which needs to be 8 characters (a-z) which have to include upper and lower characters as well as at least one number.

谁能帮我解决这个问题?

Can anyone help me with this?

推荐答案

select cast((Abs(Checksum(NewId()))%10) as varchar(1)) + 
       char(ascii('a')+(Abs(Checksum(NewId()))%25)) +
       char(ascii('A')+(Abs(Checksum(NewId()))%25)) +
       left(newid(),5)
from yourTable

相关文章