3

Can you please help me will FOR XML PATH works in Azure Synapse. If not what will be the alternative.

Thanks

user15488631
  • 85
  • 2
  • 10

2 Answers2

3

In case you you're looking to use FOR XML to prepare e.g. column names for a dynamic pivot query, then the string_agg function is what you are looking for.

string_agg documentation

JayWayze
  • 148
  • 6
0

Azure Synapse Analytics dedicated SQL pools (and serverless SQL pools) do not support the FOR XML syntax as per the documentation:

FOR XML not supported in Synapse

The easiest thing to do would be use Azure SQL DB to do your XML processing, eg use a pipeline to land your data there, call a Stored Proc activity to do the processing then retrieve it. Another fun alternative would be to use a Synapse notebook and use Python or Scala to process the XML.

wBob
  • 13,710
  • 3
  • 20
  • 37