home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,813 of 19,505   
   Erland Sommarskog to Jimbo   
   Re: SQL Error handling in SP   
   22 Jun 10 20:12:59   
   
   5a4f6ab6   
   From: esquel@sommarskog.se   
      
   Jimbo (james.goodwill@googlemail.com) writes:   
   > I have a SQL Store Procedure that performs a database backup, to a   
   > disk file, for each 'user' database in the SQL instance. The script is   
   > simple; it just uses a 'fetch' loop and performs a 'BACKUP   
   > DATABASE...'  for each database.   
   >   
   > If I run the script in QA, and one of the database backups fails for   
   > any reason - backup disk full, path not found etc., the script just   
   > loops through to the next database. Which is what I want.   
   >   
   > However, if I then run the SP as a scheduled job, the job fails, and   
   > does not continue to the next database backup.   
   >   
   > How can I get the SP to ignore the BACKUP DATABASE failure(s) when   
   > it's executed from a scheduled job? I guess these are O/S errors being   
   > passed back to SQL.   
      
   In SQL 2000, you cannot suppress errors. The problem is that Agent aborts   
   the job on errors.   
      
   I think the easiest way out is to run the job as a CmdExec job, and   
   in this job you invoke OSQL to run the procedure.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
   SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca