Use ReportServer
GO
;WITH XMLNAMESPACES (
DEFAULT
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition',
'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS
rs
)
SELECT
LinkedReport,
x.value('CommandType[1]', 'VARCHAR(50)') AS CommandType,
x.value('CommandText[1]','VARCHAR(50)') AS
CommandText
FROM (
SELECT
c1.Name AS LinkedReport, CAST(CAST(C2.content AS VARBINARY(MAX)) AS XML) AS reportXML
FROM dbo.Catalog c1
INNER JOIN dbo.Catalog AS c2 ON c1.LinkSourceID=c2.ItemID
WHERE
c1.Type =
4
) a
CROSS APPLY reportXML.nodes('/Report/DataSets/DataSet/Query') r(x)
WHERE x.value('CommandType[1]', 'VARCHAR(50)') = 'StoredProcedure'
Thanks,
Randhir
No comments:
Post a Comment