Count(*) or Count(1) ?
Every so often on the on-line forums, the question of : Which is better Count(*) or Count(1) ? will occur. So can...
2010-07-27
1,469 reads
Every so often on the on-line forums, the question of : Which is better Count(*) or Count(1) ? will occur. So can...
2010-07-27
1,469 reads
For those that may of missed it, voting for SQLBits sessions is now open. Make your voice heard and get...
2010-07-20
399 reads
I am somewhat uncomfortable blogging this, as I feel that it falls into “Polish a turd” category. Having said that,...
2010-07-02
731 reads
One of my back burner projects is to setup a local user group.
I'm delighted to now say that this is...
2010-06-28
404 reads
It’s as simple as that. If you don’t specify ORDER BY, then the order of your result set is not...
2010-06-26
716 reads
Ever been curious about the schema of , say an SSRS rdl file ? How about the execution plan ?
Not only should...
2010-06-15
494 reads
I have received a number of requests for an explanation of my winning query of TSQL Challenge 19. This involved...
2010-05-27
1,705 reads
One of my personal pet issues is with inappropriate use of the NOLOCK hint (and read uncommitted) . Don't get me...
2010-04-23
749 reads
Cross apply (and outer apply) are a very welcome addition to the TSQL language. However, today after a few hours...
2010-03-26
1,923 reads
It is widely know that data modifications on table variables do not support parallelism, Peter Larsson has a good example...
2010-03-04
558 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