declare @int int ,@dbname varchar(22) set @int = 0 while (@int < 5) begin set @dbname = (select [name] from sysdatabases where dbid=@int) if (@dbname != 'tempdb') begin BACKUP DATABASE @dbname to DISK = @dbname WITH INIT end set @int = @int + 1 continue break end Hemantgiri S. Goswami ghemant@gmail.com "Humans don't have Caliber to PASS TIME , Time it self Pass or Fail Humans" - by Hemantgiri Goswami
sysdatabases should be Master..sysdatabases [<img src='/community/emoticons/emotion-1.gif' alt='' />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail
Other Way Run this Select 'Backup Database '+name +' To disk = C:'+Name+'.Bak WITH INIT' from Master..SysDatabases where DBId in (1,3,4) Copy the results back to Query Analyser and run them Madhivanan Failing to plan is Planning to fail