Search This Blog

Job - Back up all the databases

declare @dbname varchar(40)
declare db cursor
for select name from master..sysdatabases where dbid > 1
open db
fetch db into @dbname

while @@fetch_status <> -1
Begin
exec ("backup database [" + @dbname + "] to disk = 'C:\Backups\BK_"+ @dbname +
".dmp' with init")
fetch next from db into @dbname
end
close db
deallocate db

No comments: