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 |
|---|---|---|---|
| @PostID | int | 4 | INPUT |
| @UserName | nvarchar | 100 | INPUT |
Total: 2 parameter(s)
SQL
SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO Create PROCEDURE forums_MarkPostAsRead ( @PostID int, @UserName nvarchar (50) ) AS BEGIN -- If @UserName is null it is an anonymous user IF @UserName IS NOT NULL BEGIN DECLARE @ForumID int DECLARE @PostDate datetime -- Mark the post as read -- ********************* -- Only for PostLevel = 1 IF EXISTS (SELECT PostID FROM Posts WHERE PostID = @PostID AND PostLevel = 1) IF NOT EXISTS (SELECT HasRead FROM PostsRead WHERE Username = @UserName and PostID = @PostID) INSERT INTO PostsRead (Username, PostID) VALUES (@UserName, @PostID) END END GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO