我想实现 在 Sql Server  中 Select 一条记录后锁定它,当其它的人也想要 select这个记录并欲修改时得到不能修改的提示,类是Oracle 中 如下语句
select * from patient where patientid =111 for Update nowait ,高手知道在 Ms Sql Server 中如何实现?

解决方案 »

  1.   

    select * from patient(with rowlock) where patientid =111 
      

  2.   

    select * from patient with (rowlock) where patientid =111 
    括号打错了
      

  3.   

    with (rowlock) 好像不能达到我的效果!我的意识是当我的一个工作站在使用 select * from patient with (rowlock) where patientid =111  这样的查询后,开始编辑此记录,在编辑的过程中其它的工作站在想执行同样的操作时,不再被接受 ,也就是 得到 提示“其它用户正在编辑此记录”的消息