Gouache painting of a bowl of mixed buttons and keys with one vermilion key beside a padlock

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.

Read More
Gouache painting of a small test loaf in a vermilion paper cup beside a full loaf in a tin

Temporary Stored Procedures in SQL Server: Local and Global

Temporary stored procedures start with one # sign for a local one and two for a global one, and both live in tempdb. This post creates each kind on a demo database, shows who can call them and when they disappear, and explains which database their object names resolve in. It ends with the habit that makes them useful for testing a rewrite.

Read More