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_GetForumsModeratedByUser ( @UserName nvarchar(50) ) AS -- determine if this user can moderate ALL forums IF EXISTS(SELECT NULL FROM Moderators (nolock) WHERE ForumID = 0 AND Username = @UserName) SELECT ForumID, ForumName = 'All Forums', EmailNotification, DateCreated FROM Moderators (nolock) WHERE ForumID = 0 AND Username = @UserName ELSE -- get all of the forums moderated by this particular user SELECT M.ForumID, EmailNotification, ForumName = F.Name, M.DateCreated FROM Moderators M (nolock) INNER JOIN Forums F (nolock) ON F.ForumID = M.ForumID WHERE Username = @UserName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO