Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #765
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!postnews.google.com!g7g2000vbv.googlegroups.com!not-for-mail |
|---|---|
| From | JAW <jwilliam@aglresources.com> |
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: SQL Agent job RAISEERROR roll-up |
| Date | Tue, 1 Nov 2011 07:02:09 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 53 |
| Message-ID | <3534eba6-eb7c-487e-b06a-a37cdb91b6f7@g7g2000vbv.googlegroups.com> (permalink) |
| References | <e5f0f35a-1624-40ff-aff9-877c1156d5bd@a12g2000vbz.googlegroups.com> <Xns9F8FE71831DYazorman@127.0.0.1> |
| NNTP-Posting-Host | 65.243.68.237 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1320156255 16492 127.0.0.1 (1 Nov 2011 14:04:15 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Tue, 1 Nov 2011 14:04:15 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | g7g2000vbv.googlegroups.com; posting-host=65.243.68.237; posting-account=gkZ_jAgAAACs0Bql-4AE5JwCuqQkEOoD |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | ARLUEHNKC |
| X-HTTP-UserAgent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; MS-RTC EA 2; .NET4.0C; .NET4.0E; InfoPath.2),gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:765 |
Show key headers only | View raw
On Oct 31, 5:43 pm, Erland Sommarskog <esq...@sommarskog.se> wrote: > JAW (jwill...@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, esq...@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 Changing the RAISERROR to PRINT gives the desired result though I don't consider it clean programming. I have going to try changing the serverity level next. A TRY block must be immediately followed by a CATCH block. TRY…CATCH constructs can be nested. This means that TRY…CATCH constructs can be placed inside other TRY and CATCH blocks. When an error occurs within a nested TRY block, program control is transferred to the CATCH block that is associated with the nested TRY block. To handle an error that occurs within a given CATCH block, write a TRY…...CATCH block within the specified CATCH block. Errors that have a severity of 20 or higher that cause the Database Engine to close the connection will not be handled by the TRY…CATCH block. However, TRY…CATCH will handle errors with a severity of 20 or higher as long as the connection is not closed. Errors that have a severity of 10 or lower are considered warnings or informational messages, and are not handled by TRY…CATCH blocks. Attentions will terminate a batch even if the batch is within the scope of a TRY…CATCH construct. This includes an attention sent by the Microsoft Distributed Transaction Coordinator (MS DTC) when a distributed transaction fails. MS DTC manages distributed transactions
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
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