Recently approved suggested edits (only tag-info) - all metas

1

Please login or register to vote for this query.

(click on this box to dismiss)

Biblical Hermeneutics Meta

Q&A about the site for professors, theologians, and those interested in exegetical analysis of biblical texts

declare @sql nvarchar(max)

create table #result (site sysname
                    , hostname sysname
                    , sid int                   
                    , creationdate datetime
                    , approvaldate datetime)

select @sql = N'insert into #result' + STRING_AGG(concat(N'
select ''', name ,N''' as site
     , ''',hostname ,N'''
     , s.id
     , s.creationdate
     , s.approvaldate
     from ', quotename(name), N'.dbo.suggestededits s 
     where ((s.RejectionDate IS NULL) and (s.ApprovalDate IS NOT NULL))
'),N' 
union all')
from (select convert(nvarchar(max),name) name
    -- , convert(nvarchar(max),sitename)  sitename
    -- , meta
    -- , domain
     ,  concat( 
        -- based on an idea from Glorfindel 
        -- https://meta.stackexchange.com/a/321181
        (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)
 and (name like '%.Meta')
) dbs
) dbsall

exec (@sql)



select top(##num?500##)
  site, hostname, 
  concat('https://',hostname,'/suggested-edits/',CAST(sid AS varchar)) AS [Suggested Edit Link],
  creationdate, approvaldate
from #result  
order by approvaldate DESC

Enter Parameters

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