1 declare @name varchar(100) 2 declare @disk varchar(100) 3 declare @temp varchar(100) 4 set @temp=Replace(Replace(Replace(Replace(Convert(varchar(30),GETDATE(),21),':',''),' ',''),'-',''),'.','') 5 set @name=N'DEMO'+@temp+'-完整 数据库 备份' 6 set @disk=N'F:Backup[full]DEMO'+@temp+'.bak' 7 8 BACKUP DATABASE [CMDI] TO 9 DISK = @disk 10 WITH NOFORMAT, NOINIT, NAME = @name, 11 SKIP, NOREWIND, NOUNLOAD, STATS = 10 12 13 declare @name1 varchar(100) 14 declare @disk1 varchar(100) 15 declare @temp1 varchar(100) 16 set @name1=N'DEMO'+@temp+'-差异 数据库 备份' 17 set @disk1=N'F:Backup[diff]DEMO'+@temp+'.bak' 18 BACKUP DATABASE [CMDI] TO 19 DISK = @disk1 20 WITH DIFFERENTIAL , NOFORMAT, NOINIT, NAME = @name1, 21 SKIP, NOREWIND, NOUNLOAD, STATS = 10 22 GO