Introduction to XML DML (Part 1) - Using the modify() method: insert
This is the first part of a 3 part blog which will attempt to show some different ways of how...
2012-01-16
16,220 reads
This is the first part of a 3 part blog which will attempt to show some different ways of how...
2012-01-16
16,220 reads
This is a revised post of an original article that I first published in December. Even though I thought that...
2012-01-09
258,306 reads
You can only use the position() function within an xquery predicate and can't use it to return the position value...
2011-12-28
6,772 reads
I've used SQL to generate countless blobs of xml over the years and one feature that I have come to...
2011-12-20 (first published: 2011-12-15)
8,825 reads
Database users can become orphaned for a few reasons. For example, a database restore to another instance or deleting the...
2011-10-29
1,614 reads
I know that this subject has been blogged about numerous times but I thought I'd post an alternative way of...
2011-10-28
9,023 reads
Database users can become orphaned for a few reasons. For example, a database restore to another instance or deleting the...
2011-10-20
21,481 reads
I came across this really simple best practice from BOL for the xml method exist which when used will give...
2011-10-17
1,975 reads
Is all set to be officially known as SQL 2012 and will be finally released in....... 2012!
Announced at the PASS...
2011-10-15
735 reads
SQLBits9 – “Query across the Mersey” was held in the majestic Adelphi hotel. This was my first SQLBits experience and was...
2011-10-10
896 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