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
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】