日期:2014-05-17 浏览次数:20513 次
use master;backup database [test] to disk = 'D:\Back\test_here.bak'
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
DECLARE @d VARCHAR(30)
select @d= replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
SELECT @d
DECLARE @path VARCHAR(256)
SET @path='D:\Back\test_here'+@d+'.bak'
use master;
backup database [test] to disk = @path
declare @sql varchar(2000)
set @sql=''
select @sql='use master;backup database [test] to disk = '+''''
+'D:\Back\test_'+replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
+''''+'.bak'
print @sql
/*use master;backup database [test] to disk = 'D:\Back\test_20131126105602'.bak*/