All Questions
73
questions
-1
votes
1
answer
67
views
Using numeric field names in SQL JSON [duplicate]
I have the following code example:
Insert into dbo.Data (
COL_0
select
A_1
from OPENJSON (@jsonData)
with (
A_1 nvarchar(max) '$.0'
)
which triggers:
ex {System....
0
votes
0
answers
34
views
Unable to Parse the Json file using Open Json in SQL
I've a JSON file content and I want read the content using Open JSON and load it into the SQL.
need help in loading the content to SQl.
{
"Header": {
"Time": "2023-...
1
vote
1
answer
41
views
How to dynamically load SQL tables using OPENJSON
I have a json that looks like
[{
"year": 2021,
"state": "Nebraska",
"report": "Farm Business Balance Sheet&...
0
votes
1
answer
82
views
SELECT all fields from OPENJSON
SELECT all fields from OPENJSON
I have Json data below. How can I select all available fields from OpenJson? I am using SQL Server 2016.
DECLARE @JsonData varchar(max)
SET @JsonData =
'{"status&...
2
votes
2
answers
82
views
JSON Object Query SQL Server
I have a JSON string which is the following:
[
{
"id": 103001058774,
"name": "status",
"label": "Status",
"...
0
votes
1
answer
151
views
Optimal way to filter table rows based on a variable JSON array in SQL using JOIN or other methods?
I have a table A with a large number of rows and an id column. Additionally, I have a variable @Json that can have three types of values: null, an empty array '[]', or a JSON array like '[1,2,3]'. I ...
-1
votes
1
answer
138
views
Parse JSON from tsql
I need to parse JSON using TSQL.
I find a function to create a temporary table contains all values of the json and the mode to find every elements of it.
Not there are an issue. I have a JSON with an ...
1
vote
2
answers
135
views
SELECT * FROM OPENJSON -- Not getting expected values
I am getting 0 row when selecting from OPENJSON below. I am expecting to get all 3 values "AA" for different as_of_date for CREDIT_RTG . I tried different select statements. I am running in ...
1
vote
1
answer
45
views
Can I use dot navigation when using multiple parameters to filter (compare) in SQL SELECT?
I new in SQL, I want to retrieve only the records of a certain groupID and I am using this query:
SELECT @Date, Capacity, UserOrUserGroup
FROM UCTimePhaseMonthly
WHERE Date >= 2023-05-01
AND ...
0
votes
1
answer
113
views
Getting NULL with OPENJSON read JSON with SQL
I have JSON like below. and I want to find all models from the JSON.
When I give below SQL query it gives me only Sedan models
DECLARE @PermsJSON NVARCHAR(MAX) =<json>;
select * from OPENJSON(@...
2
votes
1
answer
2k
views
Explode/normalize a column with JSON stored as a string into rows and columns [duplicate]
I am using SQL Server and have a column that has JSON stored as a string in it. I am trying to explode/normalize the JSON into new rows and columns. Below is a picture of how the table currently looks....
0
votes
0
answers
104
views
Default value for column is not set at moment of insert using openjson
Consider the following statement to create a table, note the default value for MyDateTime:
USE [MY_DATABASE]
GO
ALTER TABLE [dbo].[MyTable] DROP CONSTRAINT [DF_MyTable_MyDateTime]
...
0
votes
1
answer
99
views
OPENJSON - parsing nested JSON preserving relations
I have a JSON array that looks like this
[
{
"_id": "12345",
"uniqueId": null,
"companyName": "ABC Corp",
"yearFounded": ...
0
votes
1
answer
56
views
Json input to Sql table
I've a requirement to load the json input into a table which has multiple arrays
declare @json nvarchar(max);
set @json =
'{
"method":"email",
"value&...
-1
votes
1
answer
57
views
How can I modify JSON object from a column while retrieving the data in SQL Server
I have a JSON array object like below in a SQL Server table column:
[
{
"Name": "test1",
"Favouties": {
"LikedColor": "Red",
&...