SELECT au_lname FROM authors WITH (ROWLOCK)

解决方案 »

  1.   

    以下方法:
    1.设置事务隔离级别
    2.对SELECT、INSERT、UPDATE 和 DELETE 语句使用表级锁定提示
      

  2.   

    TO:happyflystone(没枪的狙击手) 
    这个方法不起作用呀,不知我用的对不对,看看--存储过程
    CREATE PROCEDURE tmp_sp_update
    as
    update authors set address='bj' where au_id='172-32-1176'
    go--测试过程
    begin tran
    SELECT * FROM authors WITH (ROWLOCK) where au_id='172-32-1176' 
    exec tmp_sp_update
    commit tranSELECT * FROM authors where au_id='172-32-1176'
      

  3.   

    1.playxingxing你对一些概念还很模糊,多看看帮助
    2.给个例子可以参考一下
    --测试环境
    create table test(a int primary key ,b sysname)
    go
    --测试数据
    insert test
    select id,name 
    from sysobjects
    goA连接先执行:
    begin tran
    select * from test with (rowlock,repeatableread) where a = 3
    waitfor delay '00:00:05'
    commit tran然后紧接在B连接中分别测试:
    1.
    select * from test where a = 3 --读取不需要等待
    2.
    update test set a = a where a = 3 --修改则需要等待
    3.
    update test set a = a where a <> 3 --修改则不需要等待