Here is the script that takes backup of all databases excluding system databasesThe file name would be databasename_yyyymmdd where yyyymmdd is the formatted value of current date
Read more: Beyond Relational
create procedure Backup_all_databases
as
Declare @sql varchar(8000)
set @sql=''
select @sql=@sql+
'
Backup database '+name+' to disk=''E:\backup\'+name+'_'+convert(varchar(8),getdate(),112)+'.bak'''
from master..sysdatabases
where
name not in ('master','tempdb','model','msdb','pubs','Northwind')
--print @sql
EXEC(@sql)
Read more: Beyond Relational
0 comments:
Post a Comment