• Well, I didn't catch the error on the select from Foobar, but just thought about locking while selecting/inserting.

    I didn't really look into the temp table as this should be local to the procedure, but the constraint eluded my reading abilities. I have on other occations been bitten by ghe "named sometning" in a procedure, so I should be warned.

    Anyway, the "select any two correct" should have hinted at the correct answer. If we disregard deadlocks between concurrent runs, then instance #2 should always wait for instance #1, så if it were possible to complete #2 at all, it should. And as others have pointed out: If both completed, you would have 3 check marks.