使用Azure的SQLServer的我想只有一列转换为JSON格式。该数据是在一个nvarchar的字段。使用For Json Auto
将转换所有领域和所有行。我需要的是只是转换只有一列。
通过转换为JSON我的意思是可以点击看到它的数据内SSMS的新窗口。
假设表(日志)有2列:LogId
和LogData
。 LogData
是nvarchar(max)
并包含JSON数据。
我需要的是查询表,并有一个可点击的logData
列。
你可以尝试像下面只得到一个列JSON
select o.*,
(select YourColumnForJson
from YourTable i
where o.Identifer=i.Identifer for json auto) as JsonColumn
from YourTable o