Activity overview
Latest activity by spider
I finally worked it out, I was missing the WITH NAME switch before the INIT or ERASEFILES. This script works with all the User Databases.
SET NOCOUNT ON
DECLARE @dbname sysname
DECLARE @backupstring varchar(1000)
DECLARE backup_cursor CURSOR FOR
SELECT name
FROM sysdatabases
WHERE dbid > 4
OPEN backup_cursor
FETCH NEXT FROM backup_cursor
INTO @dbname @FETCH_STATUS = 0
BEGIN
set @backupstring = '-SQL "BACKUP DATABASE TO DISK = ''e:\backup\'+ @dbname +'.sqb'' WITH NAME = '''+ @dbname +''', INIT, COMPRESSION = 1" -E'
exec master..sqlbackup @backupstring
FETCH NEXT FROM backup_cursor
INTO @dbname
END
CLOSE backup_cursor
DEALLOCATE backup_cursor / comments
I finally worked it out, I was missing the WITH NAME switch before the INIT or ERASEFILES. This script works with all the User Databases.
SET NOCOUNT ON
DECLARE @dbname sysname
DECLARE @backupstri...
Erase Files not working
Hi Guys
I have the following script to backup all user databases, I can not get it to erase the old backup files, they are now 2 days old, the user has permission to delete the files, I'm sure its ...