Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
248 views

SQL Server 2019 - Build JSON with spread operator

I'm required to supply a json object like this: [ { id: '59E59BC82852A1A5881C082D5FFCAC10', user: { ...users[1], last_message: "16-06-2022", ...
Joe's user avatar
  • 1,045
0 votes
1 answer
3k views

How to extract array data from a JSON Column in SQL Server (OPENJSON, JSON_QUERY)

We have a SQL Server table that has a varchar(max) column with JSON data, but one of the fields is an array. Try as I might I can't get it to extract these one-per-row. In the past I've managed to do ...
Bobby Tables's user avatar
2 votes
1 answer
2k views

Access JSON_VALUE from SQL Column containing JSON String with Arrays

Looking to use JSON_VALUE to access some data within a JSON column in an SQL Server table. I have a table (tblMyTable) that has the following columns and data; | Column1 | JSONColumn | | -------- ...
CapnComic's user avatar
0 votes
1 answer
891 views

Remove elements from a JSON array, with no key

I'm looking for a way that I can remove elements from a JSON array in SQL Server, I tried using JSON_MODIFY/OPENPATH, but I can't seem to get the path parameter correct. Here is an example of what I ...
John McDonnell's user avatar
0 votes
1 answer
492 views

T-SQL JSON: JSON_QUERY is returning a json string after comparing the object with a string

I'm trying to return a JSON_QUERY field only if the JSON contains a specific field/property, but when I compare it with a string (that is the field's name), the function doesn't returns a JSON... ...
Fernando Moreno's user avatar
0 votes
1 answer
2k views

How to parse a json string to flat rows in SQL Server?

I have data like below in a file which I read into a variable in SQL Server: { "TypeCode": [ { "DestinationValue": "Private", "SourceValue": &...
user avatar
1 vote
1 answer
3k views

Concatenate Array Values Using Json_Query

I have a table in a SQL Server database that stores JSON in one of its columns. The structure is as follows: Table Person | Name | ExtraInfo | |--------|:----------...
Dalsier's user avatar
  • 387