Q&A for people studying math at any level and professionals in related fields
DECLARE @TextToFind nvarchar(100) = '#comment'; DECLARE @CommentId int = ##CommentId?0##; DECLARE @RawLink nvarchar(512) = '##RawLink?null##'; DECLARE @HashTagIndex int; If @CommentId > 0 Begin Select PostId as [Post Link], Score, [Text], CreationDate, UserId As [User Link] From Comments Where Id=@CommentId End Else Begin Select @HashTagIndex = CHARINDEX(@TextToFind, @RawLink) If @HashTagIndex<1 Begin Select 'Invalid or not supported comment URL, sorry' End Else Begin Select 'success' End End