MS SQL Server 2000 按日期自动备份
ms sql server 2000
1.管理-作业-步骤-命令
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '')
set @strPath = REPLACE(@strPath, '-' , '')
set @strPath = REPLACE(@strPath, ' ' , '')
set @strPath = 'D:\bak\' + 'DatabaseName_'+@strPath + '.bak'
BACKUP DATABASE [DatabaseName] TO DISK = @strPath WITH NOINIT ,
NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
2.参数
‘D:\bak\’改为备份文件路径
‘databasename’为需备份的数据库
3.生成备份文件名称
DatabaseName_20190318224500.bak