I have a column with a "Payload" of data. It represents a dynamic field where an application pulls all of the data from a source (API, stored procedure, etc) into one column in one table. Each payload can be a different set of columns, so I cannot land the information into a table. But I need my team to be able to pull out the information. The delimiters are static. Example: Source table looks like this
ID Payload
123 {"Transaction":"123456","Transaction2":"789123"}
124 {"Transaction":"123457","Transaction2":"789124"}
I would like the final output to be:
ID Transaction Transaction2
123 123456 789123
124 123457 789124
I have a split function that I can pass through twice to get me the following:
ID SplitID Split SplitID2 Split 2
123 1 transaction:123456 1 transaction
123 1 transaction:123456 2 123456
123 2 transaction2:789123 1 transaction2
123 2 transaction2:789123 2 789123
124 1...
So now I need to flatten this without using dynamic SQL... OR putting this in a place where a team of 20 can consume and use on a regular basis with NO persisting tables, etc...
Edit: We currently have SQL 2012. We are a few months out from 2017. Sorry for the lack of documenting.