Find Procedures for Reports using Query


--WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition', 'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd )
--SELECT ReportName = name
--    ,DataSourceName = x.value('(@Name)[1]', 'VARCHAR(250)')
--  ,DataProvider = x.value('(ConnectionProperties/DataProvider)[1]','VARCHAR(250)')
--  ,ConnectionString = x.value('(ConnectionProperties/ConnectString)[1]','VARCHAR(250)')
-- FROM ( SELECT C.Name,CONVERT(XML,CONVERT(VARBINARY(MAX),C.Content)) AS reportXML
--      FROM ReportServer.dbo.Catalog C
--     WHERE C.Content is not null
--      AND C.Type = 2

-- ) a
-- CROSS APPLY reportXML.nodes('/Report/DataSources/DataSource') r ( x )
--ORDER BY name ;


WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition', 'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd )
SELECT ReportName = name
   -- ,DataSetName = x.value('(@Name)[1]', 'VARCHAR(250)')
 --,DataSourceName = x.value('(Query/DataSourceName)[1]','VARCHAR(250)')
 ,CommandText = x.value('(Query/CommandText)[1]','VARCHAR(250)')
 --,Fields = df.value('(@Name)[1]','VARCHAR(250)')
 --,DataField = df.value('(DataField)[1]','VARCHAR(250)')
 --,DataType = df.value('(rd:TypeName)[1]','VARCHAR(250)')
 --,ConnectionString = x.value('(ConnectionProperties/ConnectString)[1]','VARCHAR(250)')
 FROM ( SELECT C.Name,CONVERT(XML,CONVERT(VARBINARY(MAX),C.Content)) AS reportXML
      FROM ReportServer.dbo.Catalog C
     WHERE C.Content is not null
      AND C.Type = 2
 ) a
 CROSS APPLY reportXML.nodes('/Report/DataSets/DataSet') r ( x )
 --CROSS APPLY x.nodes('Fields/Field') f(df)
ORDER BY name

Comments

Popular posts from this blog

TSQL To Get All the Names of tables and Databases whose data have changed in last 24 Hours

To Get All the Names of tables and Databases their data have changed in last 24 Hours And Backup those databases

Apply paging in procedure