Here
is the simple script for backup all database except system database.
declare
@DbBackup varchar(max)=null
select
@DbBackup=coalesce(@DbBackup+char(10)+char(13),'')+'backup
database '+Name+'
to
disk=''D:\Backup\'+name+CONVERT(varchar(10),getdate(),112)+'.BAK'''
from
sys.databases
where
name not
in('master','tempdb','model','msdb')
print
@DbBackup
Comments
Post a Comment