Declare @DataStr NVARCHAR(200)
set @DataStr = convert(NVARCHAR(19),getdate(),120)
set @DataStr = REPLACE(@DataStr, ':' , '')
set @DataStr = REPLACE(@DataStr,' ','')
set @DataStr = REPLACE(@DataStr,'-','')
set @DataStr = 'D:\SqlData\Bak\eonedbx_3_'+@DataStr+'.bak' --备份文件保存路径和名称
BACKUP DATABASE [数据库名] TO DISK = @DataStr WITH --执行备份命令
NOINIT ,NOUNLOAD, NOSKIP,STATS = 10, NOFORMAT