Stop OPENJSON after CROSS APPLY from showing up on new line
I have included a Sample SQL script. This script shows the desired formatting. I can't find any way to prevent the OPENJSON from being sent to a new line. For example:
SELECT *
FROM OPENJSON(@JSON, '$.Doc') AS OJ
CROSS APPLY OPENJSON(OJ.Value)
WITH (ID int) AS CAOJ
becomes
SELECT *
FROM OPENJSON(@JSON, '$.Doc') AS OJ
CROSS APPLY
OPENJSON(OJ.Value)
WITH ( ID INT ) AS CAOJ
2
votes
Scott F
shared this idea
-
James Penman commented
Yes I concur this formatting should be better. The issue is caused by the WITH clause after OPENJSON(), remove the WITH and the OPENJSON() is kept inline with the CROSS APPLY/FROM.