web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

SELECT 'FOR XML'

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have an issue getting data from SQL Server when FOR XML is used in the query.

 

For example

select Code, Name from Products for xml path('Product'), root('Products')

 

Stepping through the workflow it retrieves the result, but it seems returned as binary rather than text,  also as multiple rows.

 

Then when you use something like the Write to File action I get the error 

 

 

"mismatch with column typeCouldn't store <System.Collections.Generic.List`1[System.Object]> in XML_F52E2B61-18A1-11d1-B105-00805F49916B Column. Expected type is Byte[]."

 

 

 

If I change the SQL statement to return the data in JSON format, i.e.   FOR JSON,  not a problem.  The results are again returned as multiple rows, but the Write To File action creates me a file. 

 

Any Ideas?

 

 

 

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 276 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard