I'm using SQL Server. I have a table that contains XML of variable length as follows:
Id | TableData
-----------------
1 | <root><row RowId="225936" Attendance="250" Jobsitecity="Camp Springs" /></root>
2 | <root><row RowId="225936" Jobsitestate="MD" Jobsitezipcode="20762" Objective="Target" /></root>
The schema varies row to row. I'm looking to parse this into an HTML table.
I've tried How to convert xml as a table or html table in sqlserver but it returns an empty HTML table.
SELECT Id
,TableData
,dbo.CreateHTMLTable([TableData], NULL, NULL, NULL) AS HTMLData
FROM myTable
I've tried several permutations of CAST AS XML, FOR XML PATH, FOR XML RAW. I'm missing some nuance in this -- what am I failing to grasp?
Please advise.