declare @sql nvarchar(max) create table #dbs(dbname sysna...


Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

declare @sql nvarchar(max)
create table #dbs(dbname sysname, userid int)

select @sql = concat(
'insert into #dbs select * from ( ', string_agg(concat(N'select ''', convert(nvarchar(max),name), 
N''' [dbbame] 
, id
from ', convert(nvarchar(max),quotename(name)), N'.dbo.users
where accountid = ''11660265''
, N' union all ')
, ' ) data')
from sys.databases
where database_id > 4
and has_dbaccess(name) = 1 


select * from #dbs

select id 
from comments com
inner join (
select distinct postid 
from comments c 
inner join posts p on c.postid =
where p.owneruserid = 11930602
or c.userid = 11930602
) up on up.postid = com.postid 
-- where com.text like '%@d4rk4ng31%'
select top 1 
     id as [Comment Link]
from comments 
where text like '%@d4rk4ng31%'

Enter Parameters

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