sqlserver数据库自动备份

DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath = REPLACE(@strPath, ':' , '.')
set @strPath = 'E:\data_bak\' + '数据库名称'+@strPath + '.bak'
BACKUP DATABASE [数据库名称] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

猜你喜欢

转载自15090079858-163-com.iteye.com/blog/2019846