A random password procedure for SQL Server should use CRYPT_GEN_RANDOM, skip lookalike characters and guarantee every kind of character. This post builds one with a length and character switches, then tests 1,000 passwords. It also covers errors and safe handling.
Generate a Random Password in SQL Server Using T-SQL
To generate a random password in T-SQL, draw bytes from CRYPT_GEN_RANDOM, pick characters from a safe pool and shuffle them. This post builds one procedure that guarantees upper case, lower case, a digit and a symbol, skips look-alike characters, and proves it on 1,000 passwords. It also explains why ABS(CHECKSUM(NEWID())) can fail with an overflow error.
Salted Password Hashes With HASHBYTES and CRYPT_GEN_RANDOM
A salt makes two identical passwords look different, yet it does not slow down guessing. Here is a small demo of both, and what to use instead.
MySQL – Fix – Error – Your Password does not Satisfy the Current Policy Requirements
MySQL rejected every password with “does not satisfy the current policy requirements”. Here is how to check the validate_password settings and fix it.
SQL SERVER – Log Shipping Copy Job Failure – The Password for This Account Has Expired
A reader’s log shipping copy job was failing with ‘The password for this account has expired’. Here is how we found the cause and fixed it.






