CREATE Proc blog_InsertEntry ( @Title nvarchar(255), @TitleUrl nvarchar(255), @Text ntext, @SourceUrl nvarchar(200), @PostType int, @Author nvarchar(50), @Email nvarchar(50), @SourceName nvarchar(200), @Description nvarchar(500), @BlogID int, @DateAdded datetime, @ParentID int, @PostConfig int, @EntryName nvarchar(150), @ID int output) as if(@EntryName is not null) Begin if exists(Select EntryName From blog_Content where BlogID = @BlogID and EntryName = @EntryName) Begin RAISERROR('The EntryName you entry is already in use with in this Blog. Please pick a unique EntryName.',11,1) RETURN 1 End End if(Ltrim(Rtrim(@Description)) = '') begin set @Description = null end ---------------------------------------- ---Filtering If (@PostType = 3 or @PostType = 4) begin declare @temp_text varchar(8000) set @temp_text = UPPER(isnull(CAST(@Text as varchar(7500)),'')) + UPPER(isnull(@SourceName,'')) + Upper(isnull(@TitleUrl,'')) + Upper(isnull(@Author,'')) declare @word_buffer varchar(100) declare filterCursor CURSOR LOCAL FAST_FORWARD for select UPPER(fw_WORD) from FILTER_WORD OPEN filterCursor FETCH NEXT FROM filterCursor INTO @word_buffer WHILE @@FETCH_STATUS = 0 BEGIN IF (CHARINDEX(@word_buffer,@temp_text) > 0) begin CLOSE filterCursor DEALLOCATE filterCursor RAISERROR('Disallowed words or phrases detected. I you feel this message is in error, please contact blog owner.',11,1) RETURN 1 end FETCH NEXT FROM filterCursor INTO @word_buffer END CLOSE filterCursor DEALLOCATE filterCursor end ---------------------------------------- INSERT INTO blog_Content (Title, TitleUrl, [Text], SourceUrl, PostType, Author, Email, DateAdded,DateUpdated, SourceName, [Description], PostConfig, ParentID, BlogID, EntryName ) VALUES (@Title, @TitleUrl, @Text, @SourceUrl, @PostType, @Author, @Email, @DateAdded, @DateAdded, @SourceName, @Description, @PostConfig, @ParentID, @BlogID, @EntryName) Select @ID = @@Identity if(@PostType = 1 or @PostType = 2) Begin exec blog_UpdateConfigUpdateTime @blogID, @DateAdded End Else if(@PostType = 3) Begin Update blog_Content Set FeedBackCount = FeedBackCount + 1 where [ID] = @ParentID End