Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

UDF Random Password Generator

By rrinchuse,

UDF Random Password Generator

You can not use the RAND function directly from a User Defined Function.
So the UDF I wrote "fn_RandomPassword" uses the view "view_RandomPassword8"
to get the random charaters.

Having the random password generator is useful if you need to insert
a large number of users into a table with random passwords assigned.

For example ..

( UserLogin, UserPassword )
SELECT UserLogin, dbo.fn_RandomPassword() as UserPassword
FROM Import_Users_Table

.. all the users from the import table could be inserted
with random passwords very easily.

Total article views: 339 | Views in the last 30 days: 6
Related Articles

Insert random values

Insert random values


Generate Random Passwords using T-SQL

Use following script to generate random Passwords DECLARE @id int,@list varcharSET @list ='abcd...


Generate a random password

If you ever need a quick way to generate random passwords, this is a pretty useful way to do so.


Complex Random Password Generator

Generate passwords meeting complexity rules


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones