備份計劃(2點開始)
DECLARE @strPath NVARCHAR(200)
set @strPath = replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
set @strPath = 'H:\數據備份\' + 'FLGL_db_'+@strPath + '.bak'
BACKUP DATABASE FLGL TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
清除歷史文件
DECLARE @olddate nvarchar(50),@oldtime nvarchar(10),@cmd varchar(100)
set @oldtime='0200'
set @olddate= 'FLGL_db_' + replace(CONVERT(varchar, getdate()-7, 112),'-','')+@oldtime
set @cmd= 'del H:\數據備份\' + @olddate+'.bak'
exec master..xp_cmdshell @cmd