How to determine the result of a SQL Server DB Backup?
I am calling the following statement from withing a Stored Proc in SQL Se开发者_如何学JAVArver 2005.
Backup Database @dbname to disk = @dest
I need to be able to store the result of the 'Backup Database' in a variable so if something goes wrong I can kick off an alert to notify someone of the failure. How can I get that value?
You can execute the Backup Database command within a TRY block I believe. Simply add some code to email the error message in the catch block of the statement.
精彩评论