Click on the banner to learn about and purchase my database training on Azure

How to create a random password generator written in PHP, C # (CSharp) or Transact-SQL (T-SQL)

Views: 949 views
Reading Time: 3 minutes

Hello people,
Good Morning!

In this quick post, I will show you how to create a small random password generator to be used in many different ways. I will make this script available using C # languages ​​(for use on SQL Server, with CLR), PHP and Transact-SQL.

These scripts are pretty simple, but the idea is to demonstrate how to use this feature in the main 3 technologies I use.

How to create a password generator written in PHP

php-random-password-generator-with-php

Source code:

How to create a password generator written in C # (with CLR)

sql-server-random-password-generator-clr-csharp-c

Source code:

How to create a password generator written in Transact-SQL (TSQL)

sql-server-random-password-generator-with-transact-sql-tsql

Source code

As you may have noticed in the comment of the function, it is not possible to use the RAND () function within UDF functions. If you try to do so, SQL Server will return this error message:

Msg 443, Level 16, State 1, Procedure fncGera_Senha, Line 50
Invalid use of a side-effecting operator 'rand' within a function.

To get around this, see more by accessing the post. SQL Server - Msg 443 Invalid use of a side-effecting operator 'rand' within a function.

That's it folks!
I hope you enjoyed the post and see you next time.

php c # csharp random strings passwords generator

php c # csharp random strings passwords generator