Archive

Archive for the ‘SQL PraRup’ Category

BI SQL # 174 : SQL Server DBA Scripts : List connection strings of all SSRS Shared Data sources

September 25, 2013 10 comments

Hi Folks,

In this article we are going to cover How to List connection strings of all SSRS Shared Data sources.

In this post we are going to discuss following points:

  • Problem Statement of SQL Script:
  • Description of SQL Script:
  • SQL Script Output Column
  • Input Parameter of SQL Script
  • SQL Script Code
  • SQL Script Output Screenshot
  • User Level to execute

Problem Statement of SQL Script:

How to find List of connection strings of all SSRS Shared Data sources?

Description of SQL Script:

Let’s say you want to move a database to an other SQL Server, but which of the SSRS Shared Datasources uses this database and must be changed afterwards?

With this Transact-SQL query for ReportServer database you get the connection string of all Shared Datasources, to document the usage or to search for a specific server/database.

SQL Script Output Column

image

Input Parameter of SQL Script

Directly execute the script on Report Server Database.

SQL Script Code

WITH XMLNAMESPACES 
    -- XML namespace def must be the first in with clause. 
    (
    DEFAULT 
    'http://schemas.microsoft.com/sqlserver/reporting/2006/03/reportdatasource'
    ,
    'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' 
    AS rd
    )
    ,SDS
AS (
    SELECT SDS.NAME AS SharedDsName
        ,SDS.[Path]
        ,CONVERT(XML, CONVERT(VARBINARY(max), content)) AS DEF
    FROM dbo.[Catalog] AS SDS
    WHERE SDS.Type = 5
    ) -- 5 = Shared Datasource 
SELECT CON.[Path]
    ,CON.SharedDsName
    ,CON.ConnString
FROM (
    SELECT SDS.[Path]
        ,SDS.SharedDsName
        ,DSN.value('ConnectString[1]', 'varchar(150)') AS 
        ConnString
    FROM SDS
    CROSS APPLY SDS.DEF.nodes('/DataSourceDefinition') AS R(DSN
        )
    ) AS CON
-- Optional filter: 
-- WHERE CON.ConnString LIKE '%Initial Catalog%=%TFS%' 
ORDER BY CON.[Path]
    ,CON.SharedDsName;

SQL Script Output Screenshot

image

User Level to execute

300

    Hope you will like How to List connection strings of all SSRS Shared Data sources.

    If you really like reading my blog and understood at least few thing then please don’t forget to subscribe my blog.

If you want daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog :

Link Resource Website

For More information related to BI World visit my Mentalist Blog

SQL Server Mentalist >> SQL Learning Blog

Business Intelligence Mentalist >> BI World

Infographic Mentalist >> Image worth explaining thousand Words

Microsoft Mentalist >> MVC,ASP.NET, WCF & LinQ

DBA Mentalist >>Advance SQL Server Blog

Microsoft BI Mentalist >> MS BI Development Update

Connect With me on

| FaceBook |Twitter | linkedIn| Google+ | WordPress | RSS |