Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #763

Re: SQL Agent job RAISEERROR roll-up

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: SQL Agent job RAISEERROR roll-up
Date 2011-10-31 22:43 +0100
Organization Erland Sommarskog
Message-ID <Xns9F8FE71831DYazorman@127.0.0.1> (permalink)
References <e5f0f35a-1624-40ff-aff9-877c1156d5bd@a12g2000vbz.googlegroups.com>

Show all headers | View raw


JAW (jwilliam@aglresources.com) writes:
> I have and SPROC that calls the below via a  cursor so parameters can
> be based from a table.
> 
> When in run it in SSMS it gives the desired results. Any file that
> errors it it continues on to the next which is what I want.
> 
> When I take the caller of the below and put it in  a SQL Agent job it
> dies on the first error.
> 
> Somehow the RAISEERROR percolates to the top of the stack and stops
> the job.
 
This seems familiar; When Agent notices that the job raises and error, it 
sends an attention signal to SQL Server to cancel execution. I don't know 
of any way to change this behaviour. I think your best bet is to log the 
errors in a table, and then raise an error at the end.

-- 
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

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

SQL Agent job RAISEERROR roll-up JAW <jwilliam@aglresources.com> - 2011-10-31 11:51 -0700
  Re: SQL Agent job RAISEERROR roll-up Erland Sommarskog <esquel@sommarskog.se> - 2011-10-31 22:43 +0100
    Re: SQL Agent job RAISEERROR roll-up JAW <jwilliam@aglresources.com> - 2011-11-01 07:02 -0700
      Re: SQL Agent job RAISEERROR roll-up JAW <jwilliam@aglresources.com> - 2011-11-01 09:39 -0700
        Re: SQL Agent job RAISEERROR roll-up Erland Sommarskog <esquel@sommarskog.se> - 2011-11-01 22:17 +0100

csiph-web