📄 cs_weblog_trackedthreadsbyuser.prc
字号:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cs_weblog_TrackedThreadsByUser]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[cs_weblog_TrackedThreadsByUser]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].cs_weblog_TrackedThreadsByUser
(
@SectionID int,
@UserID int,
@SettingsID int
)
AS
SET Transaction Isolation Level Read UNCOMMITTED
BEGIN
--Now we need the main post
SELECT
P.PostID, P.ThreadID, P.ParentID, P.PostAuthor, P.UserID, P.SectionID, P.PostLevel, P.SortOrder, P.Subject, P.PostDate, P.IsApproved,
P.IsLocked, P.IsIndexed, P.TotalViews, P.Body, P.FormattedBody, P.IPAddress, P.PostType, P.EmoticonID, P.SettingsID, P.AggViews,
P.PropertyNames as PostPropertyNames, P.PropertyValues as PostPropertyValues,
T.*, U.*, B.*,
T.IsLocked,
T.IsSticky,
Username = P.PostAuthor,
EditNotes = '',
AttachmentFilename = null, -- ISNULL ( (SELECT [FileName] FROM cs_PostAttachments WHERE PostID = P.PostID), ''),
Replies = 0,-- (SELECT COUNT(P2.PostID) FROM cs_Posts P2 (nolock) WHERE P2.ParentID = P.PostID AND P2.PostLevel != 1),
IsModerator = 0, --(SELECT count(UserID) from cs_Moderators where UserID = @UserID),
HasRead = 0 -- not used
FROM
cs_Posts P (nolock),
cs_Threads T,
cs_vw_Users_FullUser U,
cs_weblog_Posts B,
cs_TrackedThreads TT
WHERE
B.PostID = P.PostID AND P.PostLevel = 1 and P.IsApproved = 1 and U.SettingsID = @SettingsID and
P.UserID = U.cs_UserID AND TT.ThreadID = T.ThreadID AND TT.UserID = @UserID and
T.ThreadID = P.ThreadID and U.cs_UserID = @UserID and T.SectionID = @SectionID
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
grant execute on [dbo].[cs_weblog_TrackedThreadsByUser] to public
go
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -