Stored Procedure Properties
| Name | Value |
|---|---|
| Owner | dbo |
| Created | 2004-05-31 |
| Startup | False |
| Encrypted | False |
Creation Options
| Name | Value |
|---|---|
| QUOTED_IDENTIFIER | OFF |
| ANSI_NULLS | OFF |
Parameters
| Name | DataType | Length | Type |
|---|---|---|---|
| @UserName | nvarchar | 100 | INPUT |
Total: 1 parameter(s)
SQL
SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE forums_GetModeratedForums ( @UserName nvarchar(50) ) AS -- returns a list of posts awaiting moderation -- the posts returned are those that this user can work on -- if Moderators.ForumID = 0 for this user, then they can moderate ALL forums IF EXISTS(SELECT NULL FROM Moderators (nolock) WHERE UserName=@UserName AND ForumID=0) -- return ALL posts awaiting moderation SELECT ForumID, ForumGroupId, Name, Description, DateCreated, Moderated, DaysToView, Active, SortOrder FROM Forums WHERE Active = 1 ORDER BY DateCreated ELSE -- return only those posts in the forum this user can moderate SELECT ForumID, ForumGroupId, Name, Description, DateCreated, Moderated, DaysToView, Active, SortOrder FROM Forums WHERE Active = 1 AND ForumID IN (SELECT ForumID FROM Moderators (nolock) WHERE UserName=@UserName) ORDER BY DateCreated GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO