Random Thoughts on Aliasing
Here are many different thoughts/facts/preferences on aliasing. Most of this applies to column aliasing. Regardless of whether or not you...
2010-03-20
1,352 reads
Here are many different thoughts/facts/preferences on aliasing. Most of this applies to column aliasing. Regardless of whether or not you...
2010-03-20
1,352 reads
Now that I have several posts on what you can do with a Tally table, I figured I'd share my...
2010-03-19
5,152 reads
The Monsoon
My trip to the meeting, short as it was, involved some of the worst driving conditions I've ever personally...
2010-03-12
393 reads
In case you missed David Pless in Orlando on Tuesday, you have another chance to see his presentation tonight (Thursday...
2010-03-11
525 reads
Dealing with delimited lists (Usually separated by a comma) in SQL is a problem easily handled by a simple function...
2010-02-27
3,774 reads
In my last post, I noted that one of the biggest differences between ISNULL and COALESCE was the fact that...
2010-02-21
4,495 reads
There are a lot of arguments about which of these to use. In my opinion, they both have their place. ...
2010-02-11
9,062 reads
One of the most common mistakes made in T-SQL is thinking that these behave identically. I've personally opened up a...
2010-01-28
1,227 reads
After a while, most people who work with SQL have accumulated quite a few scripts that they use for investigation,...
2010-01-20
519 reads
Overview
This is something that most people eventually need for reporting purposes. This function uses a Tally table to 'clean' a...
2010-01-13
4,200 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