转换一列JSON

问题描述 投票:0回答:1

使用Azure的SQLServer的我想只有一列转换为JSON格式。该数据是在一个nvarchar的字段。使用For Json Auto将转换所有领域和所有行。我需要的是只是转换只有一列。

通过转换为JSON我的意思是可以点击看到它的数据内SSMS的新窗口。

假设表(日志)有2列:LogIdLogDataLogDatanvarchar(max)并包含JSON数据。

我需要的是查询表,并有一个可点击的logData列。

sql-server azure-sql-server
1个回答
1
投票

你可以尝试像下面只得到一个列JSON

select o.*,
 (select YourColumnForJson  
    from YourTable i 
        where o.Identifer=i.Identifer for json auto) as JsonColumn 
 from YourTable o
© www.soinside.com 2019 - 2024. All rights reserved.