Hi @KP ,
Thank you so much for posting here.
Please refer below options and check whether any of them is helpful to you.
Option 1: Download the latest SSMS.
Option 2: Use print instead of select like below:
DECLARE @result NVARCHAR(max);
SET @result = (SELECT * FROM table
FOR JSON AUTO, ROOT('Data'))
PRINT @result;
Option 3: Download and use Azure Data Studio which is a multi-platform re-write of SSMS (similar to how Visual Studio was re-written as VS Code).
Option 4: Try using FOR XML instead. For example:
SELECT STUFF((
SELECT ', '+name FROM sys.columns FOR XML PATH(''), TYPE
).value('.','nvarchar(max)'),1,2,'')
Option 5: Use cast result to varchar format. For example:
SELECT CAST((SELECT [Columns] FROM [Tables] FOR JSON PATH('')) AS VARCHAR(MAX)) AS JSONDATA
Option 6: Insert into a temp table.For example:
declare @json table (j nvarchar(max));
insert into @json select * from(select* from Table where Criteria1 for json auto)a(j)
select * from @json
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October--Users always get connection timeout problem when using multi subnet AG via listener. Especially after failover to another subnet