Home Forums SQL Server 7,2000 T-SQL Adding date timestamp to a backup file name RE: Adding date timestamp to a backup file name

  • declare @backupfile nvarchar(2000)

    set @backupfile = N'C:\TESTDB\TESTDB_db_' + replace(convert(nvarchar(50), getdate(), 120), ' ',':') + N'.BAK'

    BACKUP DATABASE [TESTDB] TO DISK = @backupfile ...

    I think.  Give it a try, I wrote this off the top of my head.