打开SQL Server Manager Studio工具添加作业,执行以下脚本:
declare @filename varchar(255)
declare @date datetime
select @date=getdate()
select @filename='D:\backup\filename_'+CAST(DATEPART(yyyy,@date) as varchar)+'-
'+CAST(DATEPART(mm,@date) as varchar)+'-'+CAST(DATEPART(dd,@date) as varchar)+'.bak'
backup database [dataBase-name] to disk=@filename with init
go