Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Anton Shepelev Newsgroups: comp.databases.ms-sqlserver Subject: Re: Using sp_getapplock outside a transaction Date: Wed, 29 Nov 2017 18:44:12 +0300 Organization: A noiseless patient Spider Lines: 33 Message-ID: <20171129184412.c0f5c7a5bed77e340c48b3b5@g{oogle}mail.com> References: <20171125145629.a8f9f75371e03662bf0496dd@gmail.com> <20171125182411.7cc99cc41acef664ea224b1c@gmail.com> <20171126194310.7f5514c0300678d88cf17eaa@gmail.com> <20171127113428.2629ecf62d24b8131d42d13f@g{oogle}mail.com> <20171129152226.e1d2475ae9a71ee46b35b3cf@g{oogle}mail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Info: reader02.eternal-september.org; posting-host="85cc17ee4445131a3e1c31a0d6153f8b"; logging-data="27947"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZDj92WRZckQ4s/g1PXjKwdB12FFLAMws=" X-Newsreader: Sylpheed 3.5.0 (GTK+ 2.24.23; i686-pc-mingw32) Cancel-Lock: sha1:IXq6mCeiS3Ipj8EERHJs5jSSKRc= Xref: csiph.com comp.databases.ms-sqlserver:1996 Erland Sommarskog to Anton Shepelev: >>What about error handling? In the case of pure >>nesting I could simply ensure that every >>BEGIN TRAN has a corresponding COMMIT or ROLLBACK, >>probably with the help of a TRY..CATCH block. In >>the current model, however, it is a tad less triv- >>ial, because I must test @@TRANCOUNT to see >>whether a nested call did not roll back my trans- >>action in the course of its own error handling >>logic. > >If you don't want to use TRY-CATCH, you need to >write some tedious piece of code. The hay surely smelleth of that weed. I was think- ing along the lines of: https://technet.microsoft.com/en-us/library/aa175920(v=sql.80).aspx Or did you mean something else? >On my web site there is a series of articles on er- >ror and transaction handling in SQL Server, which >starts here: >http://www.sommarskog.se/error_handling/Part1.html Thank you, I have started to read it and enjoy arti- cle very much. Kudos for a clean website. -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]