set @T='B'+char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)+replicate('0',8-len(cast(@i as varchar)))+cast(@i as varchar)
随机大写字母
char(rand()*26+65)+,
8位数字序号,自动补0
replicate('0',8-len(cast(@i as varchar)))+cast(@i as varchar)
随机小字字母
select char(rand()*26+97)
本文介绍了一种使用SQL生成带有随机字母前缀及自动补零数字序号的方法。具体包括生成随机大写字母、确保8位数字序号在长度不足时自动补充零等内容,适用于需要唯一标识符的场景。
1万+

被折叠的 条评论
为什么被折叠?



