Created
April 11, 2016 19:18
-
-
Save kristinaconley/8c8fbd07a743ae96b3626d88412bd28b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%' | |
WHERE CON.ConnString like '%C1%' | |
ORDER BY CON.[Path] | |
,CON.SharedDsName; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment