Quantcast
Channel: User Huzefa - Stack Overflow
Viewing all articles
Browse latest Browse all 5

SQL Server : I want to access Json Array of object

$
0
0
DECLARE @json varchar(max),        @errors varchar(max),        @policy_number varchar(10)SET @json = '{"returnMessage": "","policy_number": "12345","documents": {"policy_document": "",       "tax_invoice_document": ""        },"errors": [            {"error_code": "999", "error_message1": "Error"              }        ]    }'

I want to get Error_code, error_message1

SELECT    @policy_number = policy_number,    @errors = errorsFROM     OPENJSON(@json) WITH                     (                        policy_number VARCHAR(10) '$.policy_number',                         errors VARCHAR(max) '$.errors'                    )

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images