📄 cs_forums_thread_get.prc
字号:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cs_forums_Thread_Get]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[cs_forums_Thread_Get]
GO
CREATE PROCEDURE [dbo].cs_forums_Thread_Get
/*
Procedure for getting basic information on a single thread.
*/
(
@ThreadID int,
@UserID int,
@SettingsID int
) AS
SET Transaction Isolation Level Read UNCOMMITTED
SELECT
T.*,
P.PostID,
P.Subject,
P.Body,P.FormattedBody,
P.PostConfiguration,
P.PropertyNames as PostPropertyNames,
P.PropertyValues as PostPropertyValues,
UserName = T.PostAuthor,
HasRead = CASE
WHEN @UserID = 0 THEN 0
WHEN @UserID > 0 THEN (Select Convert(bit,Count(*)) FROM cs_vw_HasReadForum where ((ThreadID is null and MarkReadAfter > p.ThreadID) or (MarkReadAfter is null and ThreadID = p.ThreadID)) and UserID = @UserID and SectionID = p.SectionID)
END
FROM
cs_Posts P,
cs_Threads T,
cs_vw_Users_FullUser U
WHERE
P.PostID = P.ParentID AND
P.ThreadID = @ThreadID AND
T.ThreadID = P.ThreadID AND
P.UserID = U.cs_UserID and P.SettingsID = @SettingsID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
grant execute on [dbo].cs_forums_Thread_Get to public
go
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -