Rolling back transactions with cursors and local variables.
I’ve been doing some work on a credit card payment system lately. Obviously this needs to be robust and consistent...
2014-04-10
799 reads
I’ve been doing some work on a credit card payment system lately. Obviously this needs to be robust and consistent...
2014-04-10
799 reads
If you’re like me, you might be thinking “I want some more things to think about when I migrate between...
2014-03-27
649 reads
We all have blind spots in our knowledge. We don’t know they are there and when we are thinking through...
2014-03-13
739 reads
I’d be struggling to remember a week where I hadn’t run a query against the dmv sys.dm_db_index_usage_stats to find unused...
2014-03-10 (first published: 2014-02-27)
3,222 reads
Problem: You require the ability to perform a repeatable standardised installation of multiple instances of SQL Server or the ability...
2014-02-13
45,121 reads
The Problem: A legacy table contains amounts and a char column indicating whether the amount is a credit or a...
2014-02-11 (first published: 2014-02-04)
3,084 reads
It’s a well known fact that any sitcom that runs for a certain length of time will release a clip...
2014-01-13
1,683 reads
A while ago I blogged my about my approach to service packing a SQL Server 2008R2 active active cluster. Time...
2014-01-08
1,586 reads
I struck this error in one of my SSIS packages, I found lots of tips and suggestions online for the...
2014-01-08 (first published: 2014-01-06)
2,000 reads
The Setup:
Standard best practise is to have auto create and auto update statistics set for SQL Server databases. But there...
2013-09-03 (first published: 2013-08-28)
3,509 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