Word count a user


Please login or register to vote for this query.

(click on this box to dismiss)

English Language Learners

Q&A for speakers of other languages learning English

-- How many words a given user posted?
-- use this snippet to word count a user

DECLARE @UserId int = ##UserId##  -- SDE parameter syntax

     , LEN(Body ) - LEN(replace(Body , ' ', '')) [count]
     , sum(LEN(Body ) - LEN(replace(Body , ' ', ''))) 
         OVER (ORDER BY id) [total count]
FROM posts 
WHERE posts.OwnerUserId = @UserId
order by Id

Enter Parameters

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