获取无法解析的行的主键
Getting the Primary key of the row which can not be parsed
我正在尝试使用以下查询从 Azure Sql 数据库中的列解析 json 值
select Key, JSON_VALUE(JsonField, '$.Total')
from MyTable
但是我在解析时遇到了一些错误,产生了以下消息
[12:37:32] Started executing query at Line 12
Msg 13609, Level 16, State 2, Line 1
JSON text is not properly formatted. Unexpected character '.' is found at position 0.
有什么方法可以了解哪些行存在以下问题,例如,在 return 中将列默认设置为 NULL?
这样我就可以直接检查结果字段。
您可以使用T-SQL ISJSON
函数来识别问题值:
SELECT
Key
, JsonField
FROM dbo.MyTable
WHERE ISJSON(JsonField) = 0;
我正在尝试使用以下查询从 Azure Sql 数据库中的列解析 json 值
select Key, JSON_VALUE(JsonField, '$.Total')
from MyTable
但是我在解析时遇到了一些错误,产生了以下消息
[12:37:32] Started executing query at Line 12
Msg 13609, Level 16, State 2, Line 1
JSON text is not properly formatted. Unexpected character '.' is found at position 0.
有什么方法可以了解哪些行存在以下问题,例如,在 return 中将列默认设置为 NULL?
这样我就可以直接检查结果字段。
您可以使用T-SQL ISJSON
函数来识别问题值:
SELECT
Key
, JsonField
FROM dbo.MyTable
WHERE ISJSON(JsonField) = 0;