Find all the tables and columns used in SSRS reports

SQL DBA 0 Reputation points
2023-07-17T18:54:32.89+00:00

Is there a way to find all the tables and columns used in SSRS reports? Below query gives the column names but not the table names.

WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2016/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_ATLSQL03.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

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,494 questions
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,034 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,486 Reputation points
    2023-07-17T19:27:13.3766667+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.