How to re-create database quickly
I was running some database unit tests and needed to drop completely everyhing in my database. There are really many...
2011-07-04
678 reads
I was running some database unit tests and needed to drop completely everyhing in my database. There are really many...
2011-07-04
678 reads
Table Value Constructors were introduced in SQL Server 2008 and enables you to (not only) insert more records with one...
2011-06-29
965 reads
It is known that you cannot get inserted identity values using OUTPUT clause when inserting to view which has instead...
2011-06-28
1,797 reads
Red Gate’s SQL Source Control (RGSSC) is very decent solution source control solution for database development. I am personally using...
2011-06-23
3,033 reads
I was using user-defined tables types (UDTT) quite intensively despite of their current disadvantages especially their forced READONLY behavior when...
2011-06-23
3,866 reads
Many years back when ASP 2.0 (not ASP.NET) was used as primary server language for web application on Microsoft platform,...
2011-06-10
752 reads
I faced problem that I had many lookup tables like ProductType, ClientType etc. and wanted to refer to their values...
2011-06-05
1,771 reads
SSMS is abbreviation of SQL Server Management Studio, according to Microsoft description it is “an integrated environment for accessing, configuring,...
2011-06-03
707 reads
SQL Treeo is free add-in to SQL Server Management Studio (SSMS) which enables user to create own folder structures within...
2011-05-25
962 reads
By Brian Kelley
I will be leading an in-person Certified Information Systems Auditor (CISA) exam prep class...
EightKB is back again for 2026! The biggest online SQL Server internals conference is...
By HeyMo0sh
Working in DevOps long enough teaches you two universal truths: That’s exactly why I...
Hi all, I just started using VS Code to work with DB projects. I...
Comments posted to this topic are about the item Fun with JSON II
Comments posted to this topic are about the item Changing Data Types
I have some data in a table:
CREATE TABLE #test_data
(
id INT PRIMARY KEY,
name VARCHAR(100),
birth_date DATE
);
-- Step 2: Insert rows
INSERT INTO #test_data
VALUES
(1, 'Olivia', '2025-01-05'),
(2, 'Emma', '2025-03-02'),
(3, 'Liam', '2025-11-15'),
(4, 'Noah', '2025-12-22');
If I run this query, how many rows are returned?
SELECT t1.[key] AS row,
t2.*
FROM OPENJSON(
(
SELECT t.* FROM #test_data AS t FOR JSON PATH
)
) t1
CROSS APPLY OPENJSON(t1.value) t2; See possible answers