declare d cursor for select name from sysdatabases where name<>'tempdb' order by crdate, name declare @db varchar(255), @next_db varchar(255) open d fetch next from d into @db dump database @db to TAPE_BACKUP volume='SS0161' with nounload, stats=10, init, noskip fetch next from d into @db while (@@FETCH_STATUS<>-1) begin fetch next from d into @next_db if (@@FETCH_STATUS=-1) break dump database @db to TAPE_BACKUP with nounload, stats=10, noinit, noskip select @db=@next_db end dump database @db to TAPE_BACKUP with unload, stats=10, noinit, noskip deallocate d