Backup Multiple Databases?
Posted on 2005-04-08
I have a SQL Server 2000 installation with close to a hundred different databases on it. I would like to create a SQL query that will simply go through and backup all of the databases to my DVD writer. I am stuck however on how to get the database names into my backup query....can you help?
Here is what I have so far. The db_name is what I need to 'variablize'. Thanks!
set quoted_identifier off
declare @backupquery varchar(1000)
set @backupquery = 'backup database '+ db_name() + ' to disk = "f:\data\'+ db_name() +'_'+convert(varchar(10),getdate(),112)+'.bak" with init '