![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Favorites_GetUsersWatching
ALTER procedure dbo.cs_Favorites_GetUsersWatching
(
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
![](/Images/OutliningIndicators/None.gif)
SELECT
U.*
FROM
cs_FavoriteUsers F,
cs_vw_Users_FullUser U
WHERE
F.OwnerID = U.cs_UserID AND
F.UserID = @UserID AND
F.SettingsID = @SettingsID AND
U.SettingsID = @SettingsID AND
(U.FavoritesShared & 2) = 2 -- sharing users
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*多了(U.FavoritesShared & 2) = 2,基本就那回事,看懂语法就好了.*/
![](/Images/OutliningIndicators/None.gif)
GO
![](/Images/OutliningIndicators/ContractedBlock.gif)
cs_Favorites_GetUsers
ALTER procedure dbo.cs_Favorites_GetUsers
(
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*设置事务隔离级别,Read UNCOMMITTED 执行脏读或 0 级隔离锁定,这表示不发出共享锁,
也不接受排它锁。当设置该选项时,可以对数据执行未提交读或脏读;在事务结束前可以更
改数据内的数值,行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有
语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。*/
SELECT
U.*
FROM
cs_FavoriteUsers F,
cs_vw_Users_FullUser U
WHERE
F.UserID = U.cs_UserID AND
F.OwnerID = @UserID AND
F.SettingsID = @SettingsID AND
U.SettingsID = @SettingsID
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//*因为用户的信息被保存到视图cs_vw_Users_FullUser里了,所以这里看着挺简单,其实字段都在
U.*里呢.那视图里的字段也是多得让人头大的.就是让你去找的了,没什么,就是麻烦.*/
![](/Images/OutliningIndicators/None.gif)
GO
posted on
2006-09-07 13:09
MainIsUsed
阅读(
141)
评论()
编辑
收藏
举报