Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: SQL Agent job RAISEERROR roll-up Date: Mon, 31 Oct 2011 22:43:03 +0100 Organization: Erland Sommarskog Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="2013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hEBdNHtc+EeXT+21gwi+q" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:39lvcbIOREYg4LFohCrttWKbduQ= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:763 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