0
I was running a query this morning similar to:
declare @sql nvarchar(max)
select @sql = concat(N'insert into #validaccounts
select distinct accountid
from (',
STRING_AGG(concat(N'
select u.accountid
from [', convert(nvarchar(max),name), N'].dbo.users u
inner join users h on h.accountid = u.acc...