Change SSRS Embedded Data Source Connections Through Code

Hello experts -

We are in the process of migrating servers and need to re-point all our SSRS data sources to the new environment. I need to find all the reports that have embedded data sources and what connection strings are being used to ensure they do not fail when the migration takes place. Is there a way to search the report server database to give me all the reports that have embedded connections?

I have searched for SQL Code that I can run against the ReportServer database with no luck. We are on SQL server 2008.

When I search the XML code of the embedded reports, below is what I find -

SSRS XML Screen Shot
The highlighted portion is what needs to change.

Any advice is appreciated.

Thank you.

-- Lisa
Lisa CallahanBusiness Intelligence AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ManjuIT - Project ManagerCommented:
Did you try checking the data source in report server page?

also check this query,

;WITH  
 XMLNAMESPACES 
     (DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' 
             ,'http://schemas.microsoft.com/sqlserver/reporting/reportdesigner' 
      AS rd) 
,DEF AS 
    (SELECT RPT.ReportPath 
           ,R.RptNode.value('(./Query/DataSourceName)[1]', 'nvarchar(425)') AS DataSourceName 
           ,R.RptNode.value('@Name[1]', 'nvarchar(425)') AS DataSetName 
           ,REPLACE(REPLACE(LTRIM((R.RptNode.value('(./Query/CommandText)[1]', 'nvarchar(4000)')))  
                    ,'>', '>') 
                    ,'&lt;', '<') 
            AS CommandText 
     FROM (SELECT RPT.Path AS ReportPath 
                 ,RPT.name AS ReportName 
                 ,CONVERT(xml, CONVERT(varbinary(max), RPT.content)) AS contentXML 
           FROM ReportServer.dbo.[Catalog] AS RPT 
           WHERE RPT.Type = 2  -- 2 = Reports 
         ) AS RPT 
     CROSS APPLY RPT.contentXML.nodes('/Report/DataSets/DataSet') AS R(RptNode) 
    ) 
SELECT DEF.ReportPath 
      ,DEF.DataSourceName 
      ,DEF.DataSetName 
      ,DEF.CommandText 
FROM DEF 

ORDER BY DEF.ReportPath 
        ,DEF.DataSourceName 
        ,DEF.DataSetName

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.