SqlServer 备份数据库语法


DECLARE @strPath NVARCHAR(200)
set     @strPath = convert(NVARCHAR(16),getdate(),120)
set @strPath = REPLACE(@strPath'-' , '')
set @strPath = REPLACE(@strPath':' , '')
set @strPath = 'D:\XRayDB_Backup\XRay_backup_'+@strPath + '.bak'

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


 备份结果:【XRay_backup_20120328 1146.bak】

 

posted @ 2012-03-28 11:55  IT-民工  阅读(293)  评论(0编辑  收藏  举报