0
declare @databasename nvarchar(50),
@timestamp nvarchar(50),
@sqlcmd nvarchar(1000)
set @databasename = (select min(name)
from sys.databases
where name not in ('master','model','tempdb','msdb'))
while @databasename is not null
begin
set @timestamp = replace(replace(replace(convert(nvarchar,getdate()),' ','_'),':','_'),'-',' ')
set @sqlcmd = 'BACKUP DATABASE '[email protected]+' TO DSIK=' + ' C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\'+ @databasename +'_'[email protected]+'.bkp'
exec (@sqlcmd)
set @databasename = (select min(name)
from sys.databases
where name not in ('master','model','msdb','tempdb')
and name > @databasename)
end;
go
請問您能解釋一下您的問題嗎? 你有什麼錯誤? –