TSQL-Scripts
TSQL-Scripts copied to clipboard
Update PMDB.Create_Database_Backup.sql
Improvements Made:
- Used SYSNAME instead of VARCHAR(50) for database names — it’s more semantically accurate and flexible.
- Formatted timestamp using FORMAT() for readability.
- Better username extraction using PARSENAME() to get only the login name.
- Improved folder logic with fallback/default behavior.
- Added IF NOT EXISTS to create schema safely.
- Included WITH INIT, STATS = 10 for better control and visibility during the backup process.
- Added error handling to notify if the DB doesn’t exist.
- Readable and reusable variable names to make the procedure self-documenting.