数据库备份 作业中的Sql语句:
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '_')
set @strPath = REPLACE(@strPath, '-' , '_')
set @strPath = REPLACE(@strPath, ' ' , '_')
set @strPath = 'F:/数据库备份/' + myData_'+@strPath + '.bak'
BACKUP DATABASE [myData] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
作业删除
select * from msdb.dbo.sysmaintplan_subplans
select * from msdb.dbo.sysmaintplan_log
delete from msdb.dbo.sysmaintplan_subplans
delete from msdb.dbo.sysmaintplan_log