几乎正确
OPENJSON
declare @j nvarchar(max)= N'[{"tagType": "Author", "tagValue": "Anne Author"}, {"tagType": "Business", "tagValue": "the bidness"}, {"tagType": "Geography", "tagValue": "US"}, {"tagType": "Subscription", "tagValue": "A subscription"}]'
SELECT tagType, tagValue
FROM OPENJSON(@j)
WITH (
tagType varchar(20),
tagValue varchar(20)
)
WHERE tagType = 'Geography'
后果
|
标签类型
|
tagValue
|
|
著者
|
安妮作家
|
|
商业
|
招标
|
|
地理
|
美国
|
|
订阅
|
订阅
|
更新:
SELECT tagValue
FROM OPENJSON(@j)
WITH (
tagType varchar(20),
tagValue varchar(20)
)
WHERE tagType = 'Geography'
结果是:“美国”