Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 19,247 of 19,505    |
|    Anton Shepelev to All    |
|    Using sp_getapplock outside a transactio    |
|    25 Nov 17 14:56:29    |
      From: anton.txt@gmail.com              Hello, all              According to the documentation for sp_getapplock       available at               https://docs.microsoft.com/en-us/sql/relational-databases/syst       m-stored-procedures/sp-getapplock-transact-sql               lock_owner is nvarchar(32). The value can be        Transaction (the default) or Session. When the        lock_owner value is Transaction, by default or        specified explicitly, sp_getapplock must be exe-        cuted from within a transaction.              When I try, however, to get a lock owned by the ses-       sion outside a transaction:               EXEC sp_getapplock 'test', 'Exclusive', @LockOwner = 'Session'        EXEC sp_releaseapplock 'test'              it fails with:               The statement or function must be executed in the        context of a user transaction.              Does not this behavor it contradict the documenta-       tion?              --       Anton Shepelev              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca