Transactions: What commands aren’t allowed?
Transactions are great tools that every DBA and developer should learn how to use. Unfortunately not everything can be put...
2014-02-13 (first published: 2014-02-05)
4,554 reads
Transactions are great tools that every DBA and developer should learn how to use. Unfortunately not everything can be put...
2014-02-13 (first published: 2014-02-05)
4,554 reads
A little while back I was doing some research into a failed job and ran into a slight problem. The...
2014-02-10
895 reads
I probably had the most fun all week when a query I was running came up blocked. Sounds strange right?...
2014-02-03 (first published: 2014-01-27)
2,171 reads
This is a disaster and recovery trick I’ve found to be useful for developers with batch processes that hit multiple...
2014-02-02
1,362 reads
I frequently rely on joining sys.dm_exec_requests and sys.dm_exec_sql_text() to know what queries are running on a system and when I...
2014-01-29
1,181 reads
Recently we had a scenario where we had a handful of queries being blocked. Nothing unusual there but when I...
2014-01-23 (first published: 2014-01-20)
3,295 reads
While researching my last post I ran across an interesting column I hadn’t noticed before, sys.dm_exec_connections.most_recent_sql_handle. I mentioned it in...
2014-01-22
1,080 reads
I came across an interesting question on SE last week. Guid vs INT – Which is better as a primary key?...
2014-01-20 (first published: 2014-01-13)
4,762 reads
These are a couple of stored procedures I wrote to help me with security research. Each sp returns three data...
2014-01-15
898 reads
So over the last couple of posts I’ve talked about the fact that the ROLLBACK command will roll back an...
2014-01-13 (first published: 2014-01-06)
7,554 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