笔记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')

 

posted @ 2013-08-03 23:57  桦仔  阅读(494)  评论(0编辑  收藏  举报