Get tag wikis under a certain length

1

Please login or register to vote for this query.

(click on this box to dismiss)

Search for tags without a proper wiki.

Code Review

Q&A for peer programmer code reviews

-- MaxBodyLength: Max body length "Set to -1 to disable"
DECLARE @max_body_length INT = ##MaxBodyLength:INT?100##;
-- MaxExcerptLength: Max excerpt length "Set to -1 to disable"
DECLARE @max_excerpt_length INT = ##MaxExcerptLength:INT?-1##;

-- Max SE post length (see http://meta.stackexchange.com/a/176447/299387)
DECLARE @LEN_MAX INT = 30000;

BEGIN
  SELECT 
    t.TagName,
    t.Count AS [Post count],
    LEN(pExcerpt.body) AS [Excerpt length],
    LEN(pWiki.Body) AS [Wiki length]
  FROM Tags t
    LEFT JOIN Posts pExcerpt ON t.ExcerptPostId = pExcerpt.Id
    LEFT JOIN Posts pWiki ON t.WikiPostId = pWiki.Id
  WHERE
  (@max_body_length >= 0 AND LEN(pWiki.body) <= @max_body_length)
  OR (@max_excerpt_length >= 0 AND LEN(pExcerpt.body) <= @max_excerpt_length)
END

Enter Parameters

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