Forum Discussion
FOR JSON Path in Fabric Warehouse
Hi Etc
Thanks for using Fabric Community and reporting this.
Apologies for the issue you have been facing.
We are reaching out to the internal team to get more information related to your query and will get back to you as soon as we have an update.
Appreciate your patience.
- v-cboorla-msft2 years agoMicrosoft Employee
Hi Etc
Could you please share more detail about your ask and also please explain this statement more clear - "SQL server into JSON-format with FOR JSON Path-statement"?
- Etc2 years agoFrequent Visitor
Hi,
Of course, let me try to clarify my question.
Basically I want to use a table I have to create a JSON string that contains the values in the table. In Azure SQL Database, it is possible to use "JSON PATH" statement which does this. Below is an example of a code snippet that does this in Azure SQL Database:
DECLARE @sourceTable TABLE ( test1 int, test2 varchar(255) ); DECLARE @destinationTable TABLE (testRow NVARCHAR(MAX)); INSERT @sourceTable (test1, test2) VALUES (5, 'something'), (6, 'something else'); WITH r AS ( SELECT test1, test2, ROW_NUMBER() OVER (ORDER BY test1, test2) AS RowNum FROM @sourceTable ) INSERT @destinationTable (testRow) SELECT (SELECT test1, test2 FROM r WHERE RowNum = r2.RowNum FOR JSON AUTO, WITHOUT_ARRAY_WRAPPER) FROM r r2; SELECT testRow FROM @destinationTable;This will result in two JSON-formatted strings {"test1":5,"test2":"something} and {"test1":6,"test":"something else"}
My question is specifically the statement "FOR JSON"-statement in the code snippet, which is not supported in Fabric Warehouses - is there any alternatives to this in Fabric or any possible work-arounds to get the JSON-formatted string from the table?