Search code examples
sql-serverreporting-servicesdatasourcessrs-2008-r2rdl

SSRS RDL Files to Find Data source reference?


using SQL scripts what would we write to find the shared data source reference (highlighted in green) as well as the name in the blue box in SSRS rdl files?

enter image description here

I am looking for a list to pull all the report names, the data source names (in blue box) and the actual data source reference (in the green box) on the server that is used. There is a lot of overlap of names used and we need to clean up reports. (there are too many to do this manually).


Solution

  • Answer can be found here: Listing all Data Sources and their Dependencies (reports, items, etc) in SQL Server 2008 R2

    SELECT
        C2.Name AS Data_Source_Name,
        C.Name AS Dependent_Item_Name,
        C.Path AS Dependent_Item_Path
    FROM
        ReportServer.dbo.DataSource AS DS
            INNER JOIN
        ReportServer.dbo.Catalog AS C
            ON
                DS.ItemID = C.ItemID
                    AND
                DS.Link IN (SELECT ItemID FROM ReportServer.dbo.Catalog
                            WHERE Type = 5) --Type 5 identifies data sources
            FULL OUTER JOIN
        ReportServer.dbo.Catalog C2
            ON
                DS.Link = C2.ItemID
    WHERE
        C2.Type = 5
    ORDER BY
        C2.Name ASC,
        C.Name ASC;