declare @userid as nvarchar(32) declare @uid as int = ##U...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @userid as nvarchar(32)
declare @uid as int = ##UserId##
select @userid='"Id":'+cast(@uid as nvarchar)+','

select postid as [Post Link]
, @userid, len(@userid)
, [text]
, reverse([text])
, charindex(':"dI"{', reverse([text]))
, charindex(reverse(@userid), reverse([text]))
from posthistory
where posthistorytypeid = 10
and (comment = 101 OR comment = 1)
and [text] like '%'+@userid+'%'
and (charindex(':"dI"{', reverse([text])) - (len(@userid)-5) = 
    charindex(reverse(@userid), reverse([text])))
ORDER BY creationdate

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results