To rename physical file name entries for a SQL Server database, take it offline, change the catalog with MODIFY FILE, rename the files in Windows and bring the database online. This post builds a demo, shows the error a missing file causes, and gives a way to undo the change.
Rename Logical File Name of a SQL Server Database
To rename logical file name entries in SQL Server, use ALTER DATABASE with MODIFY FILE and NEWNAME. This post builds a demo database, renames both files and checks the result. It also covers names with dots and the two errors that stop a rename.
SQL SERVER – UDF – User Defined Function to Extract Only Numbers From String – Number Table Method
I rewrote my User Defined Function to extract only numbers from a string. The new one uses a numbers table, also called a Tally table, instead of a WHILE loop.
SQL SERVER – Generating Fixed Width OTP Values with Cryptographic Randomness
A Random Function for a six-digit code needs suitable randomness and deliberate formatting. A reader wanted codes for new app registrations.





