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

相關文章
相關標籤/搜索