T-SQL query that takes json columnar data and displays it in row format

In an Azure SQL database, I have a column that is storing json data. SELECT a.Response FROM [dbo].[Api] a The result of this query is json in columnar format { "PRODUCT": { "0": "a1", "1": "a2", "2": "a3", "3": "a4" }, "STOCK": { "0": 3.0, "1": 3.0, "2": 0.5, "3": 6.0 }, "SALES": { "0":… Read More T-SQL query that takes json columnar data and displays it in row format

How to extract value from middle of substring in SQL?

I have column called "CustomerId" with value "1_Nissan_028" and "2_Ferrari_035". I would like to extract "Nissan" or "Ferrari" as "CustomerName". CustomerName is located in middle of CustomerId and lenght varies. Following SQL query return values like "Nissan_" or "Ferrar". How to write SQL statement? SELECT cast( SUBSTRING( CustomerId, 6, charindex(‘_’, CustomerId) ) as nvarchar(32) )… Read More How to extract value from middle of substring in SQL?