Stored Procedure Properties
| Name | Value |
|---|---|
| Owner | dbo |
| Created | 2004-05-31 |
| Startup | False |
| Encrypted | False |
Creation Options
| Name | Value |
|---|---|
| QUOTED_IDENTIFIER | OFF |
| ANSI_NULLS | ON |
Parameters
| Name | DataType | Length | Type |
|---|---|---|---|
| @PostID | int | 4 | INPUT |
Total: 1 parameter(s)
SQL
SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO CREATE PROCEDURE forums_ApprovePost ( @PostID int ) AS DECLARE @ForumID int DECLARE @ThreadID int -- first make sure that the post is ALREADY non-approved IF (SELECT Approved FROM Posts (nolock) WHERE PostID = @PostID) = 1 -- its already been approved, return 0 SELECT 0 ELSE BEGIN -- Approve the post UPDATE Posts SET Approved = 1 WHERE PostID = @PostID -- Get details about the thread and forum this post belongs in SELECT @ForumID = ForumID, @ThreadID = ThreadID FROM Posts WHERE PostID = @PostID -- Update the thread date UPDATE Posts SET ThreadDate = getdate() WHERE ThreadID = @ThreadID -- Update the ModerationAudit table INSERT INTO ModerationAudit VALUES (GetDate(), @PostID, 'undone', 1, NULL) -- Update the forums statistics exec Statistics_ResetForumStatistics @ForumID -- Send back a success code SELECT 1 END GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO