Using the OVER clause
Over the last few years I’ve learned quite a bit about different techniques in SQL Server. This particular one has...
2013-06-10
683 reads
Over the last few years I’ve learned quite a bit about different techniques in SQL Server. This particular one has...
2013-06-10
683 reads
A couple of months ago I talked about moving a login from one server to another without the password. The...
2013-06-05 (first published: 2013-05-30)
2,339 reads
Easy way to generate a restore script.
I was asked today if I had a canned restore script handy. I don’t....
2013-06-05
996 reads
I was asked today to take a table with a social security column and put all 0s if the column...
2013-06-03
905 reads
I’ve had CROSS APPLY on the mind recently. You could probably tell since its been the subject of my last...
2013-05-28
1,468 reads
Over the last few years of studying SQL I’ve noticed 4 different uses for the command CROSS APPLY.
In the first...
2013-05-23 (first published: 2013-05-20)
21,508 reads
Earlier this week I posted The many uses of CROSS APPLY and I’m quite glad I did. I’ve been working...
2013-05-22
871 reads
So I was studying for the 70-451 and ended up reading the BOL entry for CREATE SCHEMA. I honestly can’t...
2013-05-21 (first published: 2013-05-15)
4,122 reads
In the same vein as Steve Jones’ series on Customizing SSMS this is a fairly basic trick, but one that...
2013-05-16 (first published: 2013-05-13)
3,849 reads
I was reading through Stackoverflow today and saw an interesting question. SQL inner join vs subquery. The user was comparing...
2013-05-08 (first published: 2013-05-03)
5,916 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