Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Mobile Reports - how to extract SQL Statements used by mobile reports from reporting database?

$
0
0

The below query can extract SQL used in SSRS 2008 reports. Anything like this available for SQL2016 mobile reports?

Thanks,

JQ

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 
         ) 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


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>