J2B (8/26/2016)
I need some help to remove the spaces from my backup job...Its outputting as:
"dbname_DD MMM YYYY.bak"
But I would like:
"dbname_DDMMMYYYY.bak"
Heres my T-SQL...
USE dbname
DECLARE @dbname varchar(200)
SELECT @dbname='filepath\dbname_' + REPLACE(convert(varchar(20),GetDate(),106),':','-') + '.bak'
BACKUP DATABASE [dbname] TO DISK=@dbname with compression
Thanks
Just as an "ease of maintenance" and "ease of discovery" for your backup file names, you should store the files with sortable names AND a time when the backup started in the form of dbName_YYYYMMDD_HHMISS. This is especially true when it comes to taking dozens of log file backups each day.
--Jeff Moden
Change is inevitable... Change for the better is not.