Word count a user

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

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

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

SELECT Id
     , 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

Options:
Switch sites:
loading Hold tight while we fetch your results