This is a mirror of official site: http://jasper-net.blogspot.com/

Backup All databases

| Thursday, May 13, 2010
Here is the script that takes backup of all databases excluding system databases

The file name would be databasename_yyyymmdd where yyyymmdd is the formatted value of current date

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

Posted via email from jasper22's posterous

0 comments: