Questions tagged [json-value]

77 questions
0
votes
2 answers

SQL Server : SELECT JSON Column in this JSON Structure

I would like to know will it possible to select data from below JSON structure? [ { "A": 6, "Status": 1 }, { "A": 3, "Status": 0 }, { "A": 6, "Status": 1 }, { …
tsohtan
  • 830
  • 1
  • 13
  • 33
0
votes
3 answers

Compare Date saved as varchar with DateTime

I have a table with a column jsonStr of type varchar. This is an example of an element in this column {"Date":"/Date(1602846000000)/","person":"Laura"} I want to compare this date with a static date. This is my query: select * from mytable where…
Raouf Ghrissi
  • 183
  • 2
  • 9
0
votes
0 answers

Count items of json string in SQL script (compatibility version 100, no openjson)

My Json string has couple of items and I can use json_value to get specific items and parse it. But need to know the length of items to iterate. [ {"name":"Ram", "email":"Ram@gmail.com"}, {"name":"David", "email":"David@gmail.com"}, …
Aryan Firouzian
  • 1,940
  • 5
  • 27
  • 41
0
votes
2 answers

Extract Array Element From JSON Using T-SQL

I have a following response string from Google Geocoding API stored in a SQL Server database: { "results":[ { "address_components":[ { "long_name":"Khalifa City", "short_name":"Khalifa…
knyazs
  • 99
  • 7
0
votes
1 answer

SQL JSON Query -retrieve data within a JSON array

I have the following SQL "Product" table structure: int Id nvarchar(max) Details Details contains JSON a string having the following structure: { "Id": "10001", "Description": "example description", "Variants": [{ "Title": "ABC / no", …
Razvan Olariu
  • 59
  • 1
  • 8
0
votes
1 answer

Extracting Data from JSON Array using SQL

I have a nested JSON in a sql table column and need to parse out multiple values from the "delinquincies" array. highlighted with ** in the JSON below { "creditReportDetails":[ { "accountStatusSummary":{ …
Ricky
  • 123
  • 9
0
votes
2 answers

JSON_VALUE is not working in where clause in SQL Server

I have JSON data in a column in my table. I am trying to apply where condition on the JSON column and fetch records. Employee table: Here is my SQL query: SELECT ID, EMP_NAME FROM EMPLOYEE WHERE JSON_VALUE(TEAM, '$') IN (2, 3, 4, 5, 7, 10) I am…
sridharnetha
  • 2,104
  • 8
  • 35
  • 69
0
votes
1 answer

Select Json Object as nvarchar(max) in JSON_VALUE

I do not know how to extract a path of JSON as nvarchar(max). It always returns null. I do not want to specify the fields to get because I have no idea the field names. So the idea here is select it as a string and process them later. DECLARE @json…
Hieu Le
  • 1,042
  • 8
  • 18
0
votes
1 answer

SQL Server: How to remove a key from a Json object

I have a query like (simplified): SELECT JSON_QUERY(r.SerializedData, '$.Values') AS [Values] FROM r WHERE ... The result is like this: { "2019":120, "20191":120, "201902":121, "201903":134, "201904":513 } How can I remove the…
Bart
  • 144
  • 1
  • 12
0
votes
1 answer

How can I improve SQL performance on this Json Array?

In my SQL Server 2016+, I have a table with a json column, the json column has this format: { "$type": "Sample.Product, Sample", "Name": "sample", "Id": "12345", "Policies": { "$type":…
Dongdong
  • 2,208
  • 19
  • 28
0
votes
1 answer

Assistance with JSON functions in SQL Server 2016

I have a SQL Server table with the following format: ID int JobParameters nvarchar(max) where JobParameters column contains for example: { "Parameters": [ { "SID": 35, "RPYID": 10 }, { …
DennisT
  • 45
  • 6
0
votes
1 answer

How to query a value from json array type column from a table in sql server?

I have a table with a single row of data which has a nvarchar(MAX) type column, lets name the column as json_column and the values of the column are like below: { "data": [ { "name": "john", "num": "123" }, { …
Karthik
  • 629
  • 2
  • 8
  • 12
0
votes
0 answers

Sql Server search entire Json document for value

I have a few thousand rows in my table (SQL Server 2016). One of the columns stores JSON documents (NVARCHAR(max)). The JSON documents are quite complex in therms of nesting etc.. also they can be very different one to another. My goal is to…
tom33pr
  • 853
  • 2
  • 12
  • 30
0
votes
1 answer

Getting the Primary key of the row which can not be parsed

I am trying to parse a json value from a column in Azure Sql Database with the following query select Key, JSON_VALUE(JsonField, '$.Total') from MyTable However I am encountering some error in parsing that produces the following message [12:37:32]…
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
-1
votes
1 answer

The argument 2 of the "JSON_VALUE or JSON_QUERY" must be a string literal

I am passing this JSON to a stored procedure in SQL Server { "individual": [ { "app_id": 1057029, "size": 2 }, { "app_id": 1057053, "size": 3 }, { …
Atul
  • 3,778
  • 5
  • 47
  • 87