New blogger: Jamie Wick
New SQL blogger
Jamie at the 45th Parallel (South) – New Zealand
This post is just a quick shout-out. My friend and co-leader...
2018-06-15
337 reads
New SQL blogger
Jamie at the 45th Parallel (South) – New Zealand
This post is just a quick shout-out. My friend and co-leader...
2018-06-15
337 reads
Killing Time – or removing the time element from a datetime
Over the course of time, we all collect scripts and routines...
2018-06-07
2,048 reads
One of the things that you will no doubt end up experiencing as a DBA is that you will see...
2018-05-16
1,703 reads
SSMS (and other SQL Server utilities) utilize a batch separator to, well, separate batches of T-SQL statements. Before we go...
2018-04-18
2,053 reads
Database Code Smells
I was recently reviewing a newly created T-SQL stored procedure. This procedure was verifying temporary table existence with...
2018-04-11
2,084 reads
This post talks about having primary replica jobs. That is, jobs that will only run on the primary replica of...
2018-04-02
962 reads
There are several different options available for working with tabs and spaces in SSMS. In fact, there are enough that...
2018-03-29 (first published: 2018-03-21)
2,944 reads
Do you ever find yourself working on a query and realize that you need just a bit more real estate...
2018-02-28
552 reads
As you already know, SQL Server runs as a service. And services require a service account to run under. While...
2018-03-02 (first published: 2018-02-19)
17,133 reads
Back to the SQL Server Basics with Wayne
Connecting to a SQL Server instance is one of the first things that...
2018-02-19 (first published: 2018-02-07)
2,879 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