Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Problem with Backup Script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-01 : 07:35:42
Sandra writes "For my Backup/Recovery strategy I´m using the follwing script:

Declare backup_dbs Cursor
For
Select name from sysdatabases where dbid > 6
order by name
open backup_dbs
-- Variable für das Sicherungsmedium
Declare @dbname sysname
Fetch next from backup_dbs into @dbname
while (@@Fetch_Status = 0)
begin
print 'Backup der Datenbanken ' +@dbname
-- Backup der aktuellen Datenbank
exec ('Backup database ' +@dbname+ ' to
DISK=''d:\Programme\Microsoft SQL Server\MSSQL\BACKUP\Montag\'+@dbname+'.bak with init''')
Fetch next from backup_dbs into @dbname
End
Close backup_dbs
Deallocate backup_dbs

This runs fine with one exception, instead of performing "with init" it adds with init to the backup file name. I tried several days to get it to work, but I didn´t succeed. What did I wrong ?
Any help is highly appreciated."

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-06-01 : 07:56:11
exec ('Backup database ' +@dbname+ ' to
DISK=''d:\Programme\Microsoft SQL Server\MSSQL\BACKUP\Montag\'+@dbname+'.bak'' with init')
Go to Top of Page
   

- Advertisement -