There is
multiple ways to generate the random password in sql server.
1st way
Using NEWID () function we can generate the
random password
NEWID ():- Creates a unique value of type uniqueidentifier
Select left(newid(),8) as password
Select Right(newid(),8) as password
|

2nd way
Add some character
on the NEWID ().
select cast((Abs(Checksum(newid()))%10) as varchar(1)) +
char(ascii('a')+(Abs(Checksum(NewId()))%25)) +
char(ascii('A')+(Abs(Checksum(NewId()))%25)) +
left(newid(),5) as password
|

3rd way
Using random function
select char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33) +
char(94 * RAND() + 33)
|

No comments:
Post a Comment
If you have any doubt, please let me know.