Running sqlbackup dynamically
audun
Posts: 17
Hi
I am trying out the software using sql2000 on win2003.
We have a customized backup script that is backing up our databases.
The following command fails:
exec sqlbackup '-SQL "BACKUP DATABASE ' +@dbname+' TO DISK = ''''' +@complete_filepath+''''' WITH NAME = '''''+ @BackupFile+''''', DESCRIPTION = '''''+ @Description+''''' , INIT"'END
with
Incorrect syntax near '+'.
printing the above command returns
-SQL "BACKUP DATABASE confirm_admin TO DISK = ''t:\backup\confirm_admin_full_20060506_080620.bak'' WITH NAME = ''confirm_admin_full_20060506_080620.bak'', DESCRIPTION = ''Full BACKUP at 20060506_080620.'' , INIT"
Running this commands directly in QA works fine.
Is this error to be expected?
I am trying out the software using sql2000 on win2003.
We have a customized backup script that is backing up our databases.
The following command fails:
exec sqlbackup '-SQL "BACKUP DATABASE ' +@dbname+' TO DISK = ''''' +@complete_filepath+''''' WITH NAME = '''''+ @BackupFile+''''', DESCRIPTION = '''''+ @Description+''''' , INIT"'END
with
Incorrect syntax near '+'.
printing the above command returns
-SQL "BACKUP DATABASE confirm_admin TO DISK = ''t:\backup\confirm_admin_full_20060506_080620.bak'' WITH NAME = ''confirm_admin_full_20060506_080620.bak'', DESCRIPTION = ''Full BACKUP at 20060506_080620.'' , INIT"
Running this commands directly in QA works fine.
Is this error to be expected?
Comments
DECLARE @command nvarchar(1024)
SET @command = '-SQL "BACKUP DATABASE ' +@dbname + ' TO DISK = ''' +@complete_filepath+''' WITH NAME = ''' + @BackupFile + ''', DESCRIPTION = '''+ @Description+''' , INIT"'
EXEC master..sqlbackup @command
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8