--设置文件名
-- make date string in backup filename
set @str_date = convert(varchar(50), getdate(), 121)
set @str_date = replace(@str_date, N'-', N'')
set @str_date = replace(@str_date, N':', N'')
set @str_date = replace(@str_date, N'.', N'')
set @str_date = replace(@str_date, N' ', N'')
--备份数据库
-- backup DMS database
set @backup_fullpath = @backup_path + N'DMS-' + @str_date + N'.full.bak'
backup database DMS to disk = @backup_fullpath