Lists the most commonly used tags with empty/missing/short tag wikis (wiki or excerpt). Can also identify tag wikis that are over a specified length. Enter -1 for all parameters to match all tags. Tags that have been synonymized are excluded.
Q&A for experienced flyers, pilots, and builders of drones and model aircraft
-- MaxBodyLength: Body shorter than "Set to 0 or -1 to disable" DECLARE @max_body_len int = ##MaxBodyLength:int?0## -- MaxExcerptLength: or excerpt shorter than "Set to 0 or -1 to disable" DECLARE @max_excerpt_len int = ##MaxExcerptLength:int?1## -- MinBodyLength: or body longer than "Set to -1 to disable" DECLARE @min_body_len int = ##MinBodyLength:int?12000## -- MinExcerptLength: or excerpt longer than "Set to -1 to disable" DECLARE @min_excerpt_len int = ##MinExcerptLength:int?-1## -- PlotMaximum: Max count for plot "Maximum 9999" DECLARE @limit int = ##PlotMaximum:int?100## SELECT t.Count, t.TagName, coalesce(len(pe.Body),0) as [Excerpt length], coalesce(len(pw.Body),0) as [Wiki length], pe.CreationDate, tssrc.TargetTagName as [Synonym target], tssrc.ApprovalDate INTO #TagList FROM Tags t LEFT JOIN Posts pe on pe.Id = t.ExcerptPostId LEFT JOIN Posts pw on pw.Id = t.WikiPostId LEFT JOIN TagSynonyms tssrc on tssrc.SourceTagName = t.TagName LEFT JOIN Tags tgt on tssrc.TargetTagName = tgt.TagName WHERE -- match everything if all parameters are disabled ((@max_body_len <= 0 and @max_excerpt_len <= 0 and @min_body_len = -1 and @min_excerpt_len = -1) or coalesce(len(pe.Body),0) < @max_excerpt_len -- short excerpt or coalesce(len(pw.Body),0) < @max_body_len -- short wiki or len(pe.Body) > nullif(@min_excerpt_len,-1) -- long excerpt or len(pw.Body) > nullif(@min_body_len,-1)) -- long wiki and (tssrc.SourceTagName is null -- exclude tags that are synonyms or tssrc.ApprovalDate is null -- unless it was never approved or tgt.TagName is null) -- or the synonym target is gone -- Make a list of integers -- Based on http://stackoverflow.com/questions/2157282/generate-days-from-date-range/2157776#2157776 select num into #Integers from (select (a.a + (10 * b.a) + (100 * c.a) + (1000 * d.a)) as num from (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as a cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as b cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as c cross join (select 0 as a union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9) as d ) a where a.num between 0 and (select max(Count) from #TagList where Count <= @limit) SELECT * FROM #TagList ORDER BY Count desc, [Excerpt length] asc, [Wiki length] asc, TagName SELECT num as [Number of questions], count(Count) as [Number of tags with this many questions] FROM #TagList RIGHT JOIN #Integers on #TagList.count = #Integers.num GROUP BY num ORDER BY num