Explicit and implicit datatype conversions
Did you know that 1/2=0? If you didn’t you could be in for some interesting surprises. 1/2 returns 0 because ... Continue reading
2022-08-25
40 reads
Did you know that 1/2=0? If you didn’t you could be in for some interesting surprises. 1/2 returns 0 because ... Continue reading
2022-08-25
40 reads
DBCC CLONEDATABASE is one of those features that I don’t use often but it’s really cool when I need it. ... Continue reading
2022-08-24 (first published: 2022-08-11)
536 reads
I was recently asked to review SQL Server Query Tuning and Optimization by Benjamin Nevarez (blog|twitter), and as soon as ... Continue reading
2022-08-16
116 reads
You’ll hear a lot of people complain about replication. Including me. That said, replication is an amazing tool. There really ... Continue reading
2022-08-15 (first published: 2022-08-02)
257 reads
🎶🎵 Memories, not being alone in the moonlight 🎵🎶 Kevin Kline (blog|twitter) is our host for this month’s episode of ... Continue reading
2022-08-09
18 reads
In case you didn’t know I was given notice about a month and a half ago. Since I’ve talked about ... Continue reading
2022-08-04
24 reads
I use impersonation a lot. It’s a really easy way to check if someone has the permissions they are supposed ... Continue reading
2022-08-03 (first published: 2022-07-26)
767 reads
I recently passed the second anniversary of the start of my stay in the hospital. A lot has happened since ... Continue reading
2022-07-28
32 reads
It’s T-SQL Tuesday again! Deborah Melkin (blog|twitter) is our host this month and she’d like to hear our opinion. A ... Continue reading
2022-07-27 (first published: 2022-07-12)
383 reads
A while back (6 years ago 😲) I talked about how you can change the behavior of SSMS so that ... Continue reading
2022-07-21
122 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