在sql中产生随机字符串作为用户密码
declare @randtext char(62)
declare @randnum smallint
declare @passwd char(15)
declare @tmpstr char(10)
DECLARE @counter smallint
set @randtext='abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
set @passwd=''
set @tmpstr=''
SET @counter = 1
WHILE @counter <= 15
BEGIN
set @randnum=RAND()*61
set @tmpstr=SUBSTRING(@randtext,@randnum+1,1)
select @passwd=rtrim(@passwd)+rtrim(@tmpstr)
SET NOCOUNT ON
SET @counter = @counter + 1
SET NOCOUNT OFF
END
select @passwd passwordtext
declare @randnum smallint
declare @passwd char(15)
declare @tmpstr char(10)
DECLARE @counter smallint
set @randtext='abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
set @passwd=''
set @tmpstr=''
SET @counter = 1
WHILE @counter <= 15
BEGIN
set @randnum=RAND()*61
set @tmpstr=SUBSTRING(@randtext,@randnum+1,1)
select @passwd=rtrim(@passwd)+rtrim(@tmpstr)
SET NOCOUNT ON
SET @counter = @counter + 1
SET NOCOUNT OFF
END
select @passwd passwordtext