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
![](https://secure.gravatar.com/avatar/32466f6346d312251198a478fd196b93?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
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.