Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power BI Report Server dbo.Catalog table

HI,

I'm trying converting content data from dbo.Catalog table of my Power Bi Report Server Database, but conversion of data about type = 13 (pbix files) return me an issue:

 

XML parsing line 1 character 3, illegal xml character

 

Could someone help me?

thanks!

 

Lorenzo

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Not sure what SQL query you were using that resulted above error. Please try below query:

WITH ItemContentBinaries AS
(
  SELECT
     ItemID,Name,[Type]
    ,CASE Type
       WHEN 2 THEN 'Report'
       WHEN 5 THEN 'Data Source'
       WHEN 7 THEN 'Report Part'
       WHEN 8 THEN 'Shared Dataset'
	   When 13 Then 'Power BI Report'
       ELSE 'Other'
     END AS TypeDescription
    ,CONVERT(varbinary(max),Content) AS Content
  FROM ReportServer.dbo.Catalog
  WHERE Type in (2,5,7,8,13)
),

--The second CTE strips off the BOM if it exists...
ItemContentNoBOM AS
(
  SELECT
     ItemID,Name,[Type],TypeDescription
    ,CASE
       WHEN LEFT(Content,3) = 0xEFBBBF
         THEN CONVERT(varbinary(max),SUBSTRING(Content,4,LEN(Content)))
       ELSE
         Content
     END AS Content
  FROM ItemContentBinaries
)
--The outer query gets the content in its varbinary, varchar and xml representations...
SELECT
   ItemID,Name,[Type],TypeDescription
  ,Content --varbinary
  ,CONVERT(varchar(max),Content) AS ContentVarchar --varchar
  ,CONVERT(xml,Content) AS ContentXML --xml
FROM ItemContentNoBOM

Reference: Extract RDL (XML) from the ReportServer database

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have some supplements:

1= Folder

3 = Templates

 

🙂

 

Best Kathrin

Hi @v-yulgu-msft,

 

That is the precise query that generates the error @Anonymous is reporting.   Note that the BOM for a Power BI document contents is different then the legacy SSRS reports, datasources and shared datasets.

 

Is there a different CASE WHEN clause to strip off the unique BOM characters used for Power BI contents stored in SQL Server reports catalog?

 

Thank you,

Ken

 

 

Hi @v-yulgu-msft,

 

That is the precise query that generates the error @Anonymous is reporting.   Note that the BOM for a Power BI document contents is different then the legacy SSRS reports, datasources and shared datasets.

 

Is there a different CASE WHEN clause to strip off the unique BOM characters used for Power BI contents stored in SQL Server reports catalog?

 

Thank you,

Ken

 

 

mgmeyer
Power BI Team
Power BI Team

I'm not sure exactly what you are trying to do, are you explicitly writing queries to modify the data that is in the ReportServer Catalog table? What are you trying to achieve by this? Doing something like this is not supported and could put you data/catalog in a bad state and potential break you server installation.

Anonymous
Not applicable

It's worth remembering that the Binary in the Content column for a PBIX file is actually the PBIX file itself, which is a ZIP file. So I'm pretty sure you can't meaningfully parse it as XML.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.