时间:2021-07-01 10:21:17 帮助过:19人阅读
declare @name varchar(100) declare @disk varchar(100) declare @temp varchar(100) set @temp=Replace(Replace(Replace(Replace(Convert(varchar(30),GETDATE(),21),‘:‘,‘‘),‘ ‘,‘‘),‘-‘,‘‘),‘.‘,‘‘) set @name=N‘DEMO‘+@temp+‘-完整 数据库 备份‘ set @disk=N‘F:\Backup\[full]DEMO‘+@temp+‘.bak‘ BACKUP DATABASE [CMDI] TO DISK = @disk WITH NOFORMAT, NOINIT, NAME = @name, SKIP, NOREWIND, NOUNLOAD, STATS = 10 declare @name1 varchar(100) declare @disk1 varchar(100) declare @temp1 varchar(100) set @name1=N‘DEMO‘+@temp+‘-差异 数据库 备份‘ set @disk1=N‘F:\Backup\[diff]DEMO‘+@temp+‘.bak‘ BACKUP DATABASE [CMDI] TO DISK = @disk1 WITH DIFFERENTIAL , NOFORMAT, NOINIT, NAME = @name1, SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO
MSSQL备份脚本
标签:备份脚本 diff ini date() varchar nload load blog cmd