mardi 4 août 2015

sp_getapplock not working? I would expect the following code to make a table inaccessible for other sessions however this is not the case

run the following in a sql server session

    CREATE DATABASE locktest
    GO

    CREATE TABLE locktest.dbo.lock_this_table (id INT)
    BEGIN TRAN
        EXEC locktest..sp_getapplock @Resource = 'lock_this_table',@LockMode = 'Exclusive'

In a separate window, execute the following code, I would expect it to hang whilst the first transaction remains open, any idea why it doesn't?

SELECT * FROM locktest.dbo.lock_this_table

Aucun commentaire:

Enregistrer un commentaire