Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1984
| From | Anton Shepelev <anton.txt@gmail.com> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Using sp_getapplock outside a transaction |
| Date | 2017-11-25 14:56 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <20171125145602.03fd296958694cd0d92675ef@gmail.com> (permalink) |
Hello, all According to the documentation for sp_getapplock available at https://docs.microsoft.com/en-us/sql/relational-databases/system-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? -- () ascii ribbon campaign -- against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
Back to comp.databases.ms-sqlserver | Previous | Next | Find similar
Using sp_getapplock outside a transaction Anton Shepelev <anton.txt@gmail.com> - 2017-11-25 14:56 +0300
csiph-web