一.创建一个sql文件,在里面写入以下代码: USE MasterGOdeclare @str varchar(100)set @str='D:\sqlserver14backup\CDB\'+replace(replace(replace(convert(varchar,getdate(),20),'-',''),' ',''),':','')+'.bak'BACKUP DATABASE [CDB] TO DISK=@strWITH RETAINDAYS=15,NOFORMAT,NOINIT,