【发布时间】:2011-06-21 02:07:36
【问题描述】:
我在我的存储过程中使用以下内容来创建一个 8 位密码并将其作为输出返回。
select @AuthKey = @AuthKey + char(n) from
(
select top 8 number as n from master.. spt_values
where type= 'p' and number between 48 and 57
order by newid()
) as t
但我希望输出为字母数值,而不仅仅是数值。我怎样才能得到它?
【问题讨论】:
-
好的,完成... WHERE TYPE='p' and (48 和 57 之间的数字或 65 和 90 之间的数字)
-
我不完全确定 (spt_values 的使用) 属于时尚与偷偷摸摸的比例......但我有点喜欢它!
-
@Anuya As this blog post notes “不仅可以提出和回答自己的问题,而且明确鼓励这样做。”所以我会说将您的评论移至答案,然后接受它。这也将阻止此问题出现在未回答列表中
标签: sql sql-server-2005 stored-procedures