[thelist] SQL 2000 auto create ID's
Steve Cook
steve.cook at evitbe.com
Wed Aug 14 08:45:01 CDT 2002
Personally I always do this bit in the ASP. Here's a nice general function
you can use - you feed it a string of 0's, 1's and 2's as follows:
0 = vowel
1 = consonant
2 = number
You could mocify it easily to pick randomly any alphanumeric character by
simply putting all the characters you want available in a single string and
taking out the functionality for the other types.
password = "AB" & funCreatePass "111102"
The example above would create a password beginning with AB and consisting
of 4 consonants followed by a vowel and a number.
Oh - and all the variable names and stuff are in Swedish - sorry! ;-)
function funCreatePass(format)
konsonant = "bcdfghjklmnprstv"
vokal = "aeiouy"
nummer = "0123456789"
randomize
for j= 1 to Len(format)
bokstav = mid(format, j, 1)
if bokstav = 1 then ' If the character is a 1 then pick a
consonant
password=password &
mid(konsonant,cInt(rnd*(len(konsonant)-1)+1),1)
elseif bokstav = 2 then ' If the character is a 2 then pick
a number
password=password &
mid(nummer,cInt(rnd*(len(nummer)-1)+1 ),1)
else ' If the character is anything else then pick a vowel
password=password &
mid(vokal,cInt(rnd*(len(vokal)-1)+1 ),1)
end if
next
funCreatePass = password
end function 'funCreatePass
.steve
-------------------------------------
Cookstour - http://www.cookstour.org
-------------------------------------
<SNIP>
>
> Each unique ID must start with 'AB'.
> Then I want to add after the 'AB' seven random alpha and/or
> numeric characters.
>
> The password can be anything, six characters.
More information about the thelist
mailing list