笔记180 添加锁提示 索引提示 rowlock updlock index(ix_username)
笔记180 添加锁提示 索引提示 rowlock updlock index(ix_username)
1 --添加锁提示 索引提示 rowlock updlock index(ix_username) 2 USE TransactionTestDb 3 4 5 SELECT * FROM dbo.Orders WITH(UPDLOCK) WHERE OrderNo =2 6 7 UPDATE dbo.Orders SET Price =300 FROM dbo.Orders WITH(ROWLOCK) WHERE OrderNo =2 8 9 DELETE FROM dbo.Orders WITH(ROWLOCK) WHERE OrderNo =2 10 11 --索引 12 SELECT UserID,UserName FROM dbo.Users WITH(INDEX(IX_UserName))WHERE UserName =('Bob')