SQL Server 定时备份样例

先按照此连接配置:html

http://jingyan.baidu.com/article/0bc808fc7ea4d71bd585b968.htmlsql

其中用到的SQL 语句以下:数据库

DECLARE @strPath NVARCHAR(200) 
set @strPath = convert(NVARCHAR(19),getdate(),120) 
set @strPath = REPLACE(@strPath, ':' , '.') 
set @strPath = 'D:\New folder\' + 'Databasename'+@strPath + '.mdf' 
BACKUP DATABASE [Databasename] TO DISK = @strPath WITH NOINIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

注意:1,D:\New folder\要设置成你本身的路径code

           2,Databasename为你须要备份的数据库名字htm

相关文章
相关标签/搜索