12 lines
762 B
Transact-SQL
12 lines
762 B
Transact-SQL
declare @CommandLine nvarchar(max)
|
|
SET @CommandLine = 'select distinct ru.contentid, "{Name}" dbname,
|
|
case when cast(data as nvarchar(max)) like "%mergedranges%" then "true" else "false" end merged from ~Grids GG
|
|
Join ~ROUsages RU ON RU.ContentID =GG.ContentID
|
|
where cast(data as nvarchar(max)) like "%:" + cast(rousageid as varchar(10)) + "%:" + cast(rousageid as varchar(10)) + "%"
|
|
'
|
|
declare @CommandLines nvarchar(max)
|
|
select @CommandLines = Coalesce(@CommandLines + ' UNION' + char(10), '') + Replace(Replace(Replace(@CommandLine,'~','{Name}.dbo.'),'{Name}',Name),'"','''')
|
|
from Sys.Databases where name like 'VEPROMS%'
|
|
Set @CommandLines = 'Select * from ( ' +@CommandLines + ') t1 '--where HowMany > 0'
|
|
print @CommandLines
|
|
EXEC SP_EXECUTESQL @CommandLines |