数据库自动备份脚本

DECLARE @strPath NVARCHAR(200)

set @strPath = convert(NVARCHAR(19),getdate(),120)

set @strPath = REPLACE(@strPath, ':' , '.')

set @strPath = 'F:\bak\' + 'databasename'+@strPath + '.bak'

BACKUP DATABASE [databasename] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

F:\bak\改为自己的备份路径,databasename修改为想备份的数据库的名称)

posted @ 2012-05-14 09:59  rmhy  阅读(60)  评论(0)    收藏  举报