I need to get the
MAX aggregate of certain field in a transaction. I use this value further inside the transaction. I want to avoid inserts in the entire table from which I'm getting the
MAX while the transaction is completed.
I researched the isolation modes and lock hints available. The closest seems to be
TABLOCKX, which is the only one that avoids inserts in the entire table (also updates and selects).
Since I no will be affected by updates or selects in the table I wish to avoid only inserts during the transaction. This is possible?
UPDATE: The field on wich the
MAX is performed is seted only on inserts, thus there's no risk of get stale results for updates.
I'm using SQL Server 2000.