>--SESSION 1 >DECLARE @rowsType1 TINYINT >SET @rowsType1=1 >-- time = tStart >SELECT MAX(field1) FROM myTable WITH(HOLDLOCK) WHERE field2=@rowsType1 >-- i want MAX(field1) not change for @rowsType1 rows group. >..... >COMMIT >-- time = tEnd > >--SESSION 2 >-- time : t with tStart<t<tEnd >INSERT INTO myTable (field1,field2) VALUES(34,2) >-- this can insert without lock > >--SESSION 3 >-- time : t with tStart<t<tEnd >INSERT INTO myTable (field1,field2) VALUES(34,1) >-- this is locked until t>tEnd >>