ALTER Proc blog_InsertPingTrackEntry ( @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 --Do not insert EntryNames. No needed for comments and tracks. To messy anyway Set @ID = -1 if not exists (Select [ID] From blog_Content where TitleUrl = @TitleUrl and ParentID = @ParentID) Begin if(Ltrim(Rtrim(@Description)) = '') set @Description = null ---------------------------------------- ---Filtering declare @temp_text varchar(8000) set @temp_text = UPPER(isnull(CAST(@Text as varchar(7500)),'')) + UPPER(isnull(@SourceName,'')) + Upper(isnull(@TitleUrl,'')) + Upper(isnull(@Author,'')) + Upper(isnull(@Title,'')) 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 ---------------------------------------- INSERT INTO blog_Content ( PostConfig, Title, TitleUrl, [Text], SourceUrl, PostType, Author, Email, DateAdded,DateUpdated, SourceName, [Description], ParentID, BlogID) VALUES (@PostConfig, @Title, @TitleUrl, @Text, @SourceUrl, @PostType, @Author, @Email, @DateAdded, @DateAdded, @SourceName, @Description, @ParentID, @BlogID) Select @ID = @@Identity Update blog_Content Set FeedBackCount = FeedBackCount + 1 where [ID] = @ParentID End