Tag Info

New answers tagged


Your question is about isolation not atomicity. Yes this is possible though. Setup CREATE TABLE Person ( Id INT PRIMARY KEY, Name VARCHAR(100), Surname VARCHAR(100) ); CREATE INDEX ix_Name ON Person(Name); CREATE INDEX ix_Surname ON Person(Surname); INSERT INTO Person SELECT TOP 1000000 ROW_NUMBER() OVER (ORDER BY ...


I have re-tested your function and it seems to work as advertised. If, in fact a duplicate value was entered, you would get an exception that would roll back the transaction. The function is designed to trap such an exception (UNIQUE_VIOLATION) and to try again, which would find the (now) existing row and return the existing id. Your report of ...

Top 50 recent answers are included