October 20, 2004 at 8:50 am
Hey guys,
Question for anyone that can help. My company just put out a new website earlier this week. Everything is working great, but there are still a few things that need cleaned up.
Question is: I'm wanting to create a password generator for those people who have lost/forgotten their password based on their email address and the answer to their secret question.
Does anyone know how to generate a randomly generated password using SQL? Or ASP for that matter?
Any help would be greatly appreciated
October 22, 2004 at 4:08 pm
you could try something like this that generates a random number between 65 and 122. It then converts that to a character to build the password:
create proc usp_NewPassword as
declare @number int
declare @count int
declare @password varchar(10)
declare @letter char
set @password = ''
set @count = 0
while @count <= 10
begin
set @number = rand() * 57 + 65
set @letter = char(@number)
set @password = @password + @letter
set @count = @count + 1
end
select @password
Aunt Kathi Data Platform MVP
Author of Expert T-SQL Window Functions
Simple-Talk Editor
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply