简单,在计划任务中建立 固定的执行时间即可
执行语句如下
declare @filename nvarchar(100)
set @filename='M:\\DBBACKUP\DS_db_'+replace(replace(replace(replace(CONVERT(char(16), getdate(), 120 ),'-',''),'
',''),':',''),' ','') +'.bak'
-- print @filename
BACKUP DATABASE [Enterprise] TO DISK = @filename WITH NOINIT , NOUNLOAD , NAME = N'Enterprise_BACKUP', NOSKIP , STATS = 10, NOFORMAT
其中,请自己修正文件的路径,最后backup 下来的文件就是 YYYYmmDDHHMM 格式的,呵呵,贡献给大家免费使用!
set @filename='M:\\DBBACKUP\DS_db_'+replace(replace(replace(replace(CONVERT(char(16), getdate(), 120 ),'-',''),'
',''),':',''),' ','') +'.bak'
-- print @filename
BACKUP DATABASE [Enterprise] TO DISK = @filename WITH NOINIT , NOUNLOAD , NAME = N'Enterprise_BACKUP', NOSKIP , STATS = 10, NOFORMAT