skip to Main Content

Extract value from a JSON array with no name

I have a table with a record that has JSON content and it is an array with no name. Sample data looks like this: carId carType parts Z003 Company [{"Value":"New","Type":"Brakes","Code":"D"},{"Value":"Upgraded","Type":"Doors","Code":"E1"}] Z003 Company [{"Value":null,"Type":"Brakes","Code":"D"},{"Value":null,"Type":"Doors","Code":"E1"}] Z003 Company [{"Value":"USed","Type":"Brakes","Code":"D"},{"Value":"New","Type":"Tires","Code":"G7"}] There are actually about…

VIEW QUESTION

How to create a column in SQL Server that accepts a list of inputs from ASP.NET Core WebAPI – Html

I got this html form with multi selectable checkboxes <div class="check"> <label>Addons:</label> <input type="checkbox" name ="SelectedCheckboxes[]" value="10%off First service visit" id="10%off First service visit"> <label for="10%off First service visit">10%off First service visit</label> <input type="checkbox" name="SelectedCheckboxes[]" value="10%off Waterwash" id="10%off Waterwash"> <label…

VIEW QUESTION

Babelfish : UPDATE query with JOIN – Postgresql

I have the following sample data: create table employee (id int,emp_name varchar(50),project_name varchar(50)); insert into employee(id,emp_name) values(1,'Smith'); insert into employee(id,emp_name) values(2,'Jill'); insert into employee(id,emp_name) values(3,'Hana'); create table employee_project (emp_id int,project_id int); insert into employee_project(emp_id,project_id) values(1,101); insert into employee_project(emp_id,project_id) values(2,201); insert…

VIEW QUESTION

'Incorrect syntax near '.'.' – Asp.net

TextBox txtStatus = GridView1.Rows[e.RowIndex].FindControl("TextBox6") as TextBox; string strcn = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; SqlConnection con = new SqlConnection( strcn); con.Open(); SqlCommand cmd = new SqlCommand("update Associate_Table set [Status] = @Status where [Associate ID] =+Convert.ToInt32(id.Text)", con); cmd.Parameters.AddWithValue("@Status", txtStatus.Text); int i = cmd.ExecuteNonQuery(); con.Close(); plz…

VIEW QUESTION

T-sql extract json string to multiple columns

I have one table which contains one JSON string column. How can I extract the information this into several different columns? The json column values look something like this: [{"Name":"Id1","Value":"11ea1111-cc22-3bb3-a33d-62159f192eba"}, {"Name":"Id2","Value":"b2222222-7777-00eb-0cc1-12345687bbbb"}, {"Name":"Id3","Value":"5d65d2c1-151e-41b4-af00-12345687aaaa"}, {"Name":"Id4","Value":"5bbd0da5-7698-4fa6-a893-9874654123aa"}, {"Name":"Quantity","Value":"10"}, {"Name":"Id5","Value":"d22222-8877-4558-ah32-789456123"}] I would like to extract…

VIEW QUESTION

SQL Server: convert JSON variable to XML

I have a variable which contains a single JSON object like declare @jsonVar nvarchar(max) = N'{"key1":"value1","key2":"value2"}'; I need to convert it to XML and get something like this (or without 'root' at all) <root> <key1>value1</key1> <key2>value2</key2> </root> The solution should…

VIEW QUESTION
Back To Top
Search