Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: Using sp_getapplock outside a transaction Date: Tue, 28 Nov 2017 08:50:21 +0100 Organization: Erland Sommarskog Lines: 26 Message-ID: References: <20171125145629.a8f9f75371e03662bf0496dd@gmail.com> <20171125182411.7cc99cc41acef664ea224b1c@gmail.com> <20171126194310.7f5514c0300678d88cf17eaa@gmail.com> <20171127113428.2629ecf62d24b8131d42d13f@g{oogle}mail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="a367faad088d691bf5611ddf3370f9f3"; logging-data="4490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7LVV+ShUReNKDV1OtzfRT" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:ztOnsbQurpqAd+OCjn2SliS4ZlI= Xref: csiph.com comp.databases.ms-sqlserver:1992 (rja.carnegie@gmail.com) writes: > On Monday, 27 November 2017 10:56:34 UTC, Erland Sommarskog wrote: >> It becomes more intuitive if you stop to think in terms of "outer >> transaction". A transaction is all there is. So the ROLLBACK will >> roll back it all. >> > > Either my own understanding is wrong, or you should say, > "Do not think in terms of outer transaction" - because > the phrase "stop to think" has a different meaning. Please bear with me: English is not my native language. > I think we are agreeing that a transaction starts when > "BEGIN TRAN" first appears - or automatically if a certain > setting is in place (which I've forgotten) SET IMPLICIT_TRANSACTIONS ON > Also, we should avoid having long transactions: they block > other business and (with simple recovery) they bloat the > log file. But if it's your own server then do whatever > you want! Our transactions should be as long as needed to complete the atomic piece of work we want to do, not shorter.