For a userid, do a text search of all posts

2

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Search all userid posts for postbody
-- Wildcard search by default

DECLARE @UserId int = ##UserId##


SELECT
    Posts.Id as [Post Link],
    Posts.PostTypeId,
    Posts.Body
FROM Posts
WHERE 
    Posts.OwnerUserId = @UserId and
    (Posts.Body LIKE '%##PostBody##%')
ORDER BY Posts.PostTypeId

Enter Parameters

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