a
1
2
3
4
5select top 1 * from a
返回  1
另一个请求  select top 1 * from a  
返回 2

解决方案 »

  1.   

    select top 1 * from a with(hdldlock)
      

  2.   

    begin tran x
    select top 1 * from a with(rowlock,xlock,readpast)
    commit tran x
      

  3.   

    楼上写错了,应该是这样的,但不知道是否满足楼主的要求。
    select top 1 * from a with(holdlock)
      

  4.   

    你把commit tran x注释掉,然后拷贝到两个查询分析器里,看看执行的结果就知道了
      

  5.   

    with(HOLDLOCK)锁定一个共享锁
    具体查看联机帮助