Single-use tags escaping auto-burnination due to a blank tag wiki

0

Please login or register to vote for this query.

(click on this box to dismiss)

https://meta.stackexchange.com/questions/325125/single-use-tags-with-no-tag-wiki-but-with-rejected-proposals-for-the-tag-wiki

Stack Overflow

Q&A for professional and enthusiast programmers

declare @sql nvarchar(max)

create table #result (site sysname
                    , hostname sysname
                    , tagname nvarchar(150)
                    , wid integer
                    , eid integer)

select @sql = N'insert into #result' + STRING_AGG(concat(N'
select ''', name ,N''' as site
     , ''',hostname ,N'''
     , t.tagname
     , wikipostid
     , excerptpostid
from ', quotename(name), N'.dbo.tags t
left outer join ', quotename(name), N'.dbo.posts pw on t.wikipostid = pw.id
left outer join ', quotename(name), N'.dbo.posts pe on t.excerptpostid = pe.id
where len(pe.body) = 0
and len(pw.body) = 0
and [count] = 1 
'),N' 
union all')
from (select convert(nvarchar(max),name) name
    -- , convert(nvarchar(max),sitename)  sitename
    -- , meta
    -- , domain
     ,  concat( 
        -- based on an idea from Glorfindel
        (case sitename
        WHEN 'Audio' THEN 'video'
        WHEN 'Beer' THEN 'alcohol'
        WHEN 'CogSci' THEN 'psychology'
        WHEN 'Garage' THEN 'mechanics'
        WHEN 'Health' THEN 'medicalsciences'
        WHEN 'Moderators' THEN 'communitybuilding'
        WHEN 'Photography' THEN 'photo'
        WHEN 'Programmers' THEN 'softwareengineering'
        WHEN 'Vegetarian' THEN 'vegetarianism'
        WHEN 'Writers' THEN 'writing'
        WHEN 'Br' THEN 'pt'
        WHEN 'Mathoverflow' THEN concat((meta+'.'), sitename)
        ELSE case when sitename = domain then null else sitename end
        end +'.')
        , (case 
           when sitename <> 'mathoverflow' then (meta+'.') 
           else null 
           end) 
        , (case 
           when sitename <> 'mathoverflow' then concat((domain + '.'), 'com') 
           else 'net' 
           end)
        ) hostname
from (
select name
, case parsename(name,1) 
  when 'Meta' then parsename(name,2)
  else parsename(name,1) 
  end [sitename]
, case parsename(name,1) 
  when 'Meta' then 'meta'
  else null
  end [meta]
  , coalesce(parsename(name,3), parsename(name,2)) [domain]
from sys.databases
where database_id > 5
-- (name not like '%.Meta' or name = 'StackExchange.Meta')
) dbs
) dbsall

exec (@sql)


select site
      , concat(N'https://', hostname, '/tags/', tagname, N'/info|', tagname) [single-use]
      
from #result

Enter Parameters

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