Which communities has the most users in Stack Exchange?


Please login or register to vote for this query.

(click on this box to dismiss)



Q&A for active researchers, academics and students of physics

-- all databases
declare  db_c cursor for select [name] 
                         from sys.databases 
                         where database_id > 5 -- skip master, temp, model, msdb, Data.SE

declare @db_c_name sysname   -- holds name of db after fetch
declare @sql nvarchar(max) -- holds build up sql string

-- result table
create table #all_users ( site nvarchar(250)
                            , cnt int

open db_c
fetch next from db_c into @db_c_name
while(@@FETCH_STATUS = 0)
    --set @sql = N'use '+ QUOTENAME(@db_c_name) +';
    insert into #all_users 
    select QUOTENAME(@db_c_name), count(*) from users
   fetch next from db_c into @db_c_name
close db_c;
deallocate db_c;

select * from #all_users-- all databases
order by cnt desc

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results