Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Extracting Report Content from the SSRS Catalog

RSS
Modified on Wed, Feb 09, 2022, 4:03 PM by Administrator Categorized as SSRS (SQL Server Reporting Services), XML, XSL, and XPath

Overview

This article provides code to extract details of report definitions on an SSRS server.

Code

Run this against the "ReportServer" database on the SSRS server

drop table if exists #Reports

select 
     Path
    ,RdlContent = convert(xml, substring(convert(varchar(max), convert(varbinary(max), content)),44,10000000))
into
    #Reports
from 
    catalog 
where 
    Type = 2



;with xmlnamespaces(
    default 'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition'
    ,'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' as rd
    ,'http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition' as cl
    ,'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily' as df
)
select
    Report = r.Path
    ,DataSetName = T.c.value('@Name', 'varchar(1000)')
    ,SP = T.c.value('Query[1]/CommandText[1]', 'varchar(8000)')
from
    #Reports r
    cross apply r.RdlContent.nodes('/Report/DataSets/DataSet') as T(c)

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.