insert exclusive locking

Posted by Markus on Stack Overflow See other posts from Stack Overflow or by Markus
Published on 2010-05-27T20:48:37Z Indexed on 2010/05/27 20:51 UTC
Read the original article Hit count: 160

Filed under:

Hi, I have thought about the following SQL statements:

INSERT INTO A(a1, a2)
SELECT b1, udf_SomeFunc(b1)
FROM B

Where udf_SomeFunc makes a select on table A. As I understand, first, a shared lock is set on A (I am talking just about table A now), then, after this lock is released, an exclusive lock is obtained to insert the data. The question is: is it possible, that another transaction will get the exclusive lock on table A, just before the current transaction takes its exclusive lok on A?

© Stack Overflow or respective owner

Related posts about tsql