34,590
社区成员
发帖
与我相关
我的任务
分享
declare @str varchar(max)
select @str=isnull(@str+'
','')+'union all
select '''+name+''' as db,t2.name as tb,t1.name as trg
from '+name+'.sys.triggers t1
inner join sys.tables t2 on t1.object_id=t2.object_id'
from sys.databases
where database_id>4
select @str=stuff(@str,1,10,'')
exec( @str)