capture the message associated with the error
DoraM
Posts: 4
Hi, My backup runs as a t-SQL job with the following syntax.
select @sql = '-SQL "BACKUP DATABASE ADMIN_COMPONENTS TO DISK = ''D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\dbname_200710.sqb''
WITH COMPRESSION = 1, ERASEFILES = 3, VERIFY"'
EXEC MASTER..SQLBACKUP @SQL ,@exit_code OUTPUT,@sql_error OUTPUT
Is there away to get the error message associated with the exit code programmatically ?
select @sql = '-SQL "BACKUP DATABASE ADMIN_COMPONENTS TO DISK = ''D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\dbname_200710.sqb''
WITH COMPRESSION = 1, ERASEFILES = 3, VERIFY"'
EXEC MASTER..SQLBACKUP @SQL ,@exit_code OUTPUT,@sql_error OUTPUT
Is there away to get the error message associated with the exit code programmatically ?
Comments
The key is to use the SINGLERESULTSET option, so that the output can be stored to a table directly. E.g.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Insert Error: Column name or number of supplied values does not match table definition.
Thats the error I get when I try to run the command with singleresultset option.
thanks,
Dora.
How many result sets were returned?
Thanks.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Thanks.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8