Key Sets, or Inverted Keys - defining a key as a set of tuples
TL;DR:
I have been doing a lot of thinking about data models for the last couple of weeks. I have, just...
2017-12-19
471 reads
TL;DR:
I have been doing a lot of thinking about data models for the last couple of weeks. I have, just...
2017-12-19
471 reads
Just a quick one today. TL;DR: Remove yourself from some unnecessary AD groups.
If you've ever received the message "login failed...
2017-11-24 (first published: 2017-11-12)
3,364 reads
If you're seeing this for the second time, my apologies. I wanted to update the title but had to delete...
2017-11-13
2,954 reads
Tricky triggers
In my last entry I noted that the performance of "instead-of" triggers can be tricky.
One of the reasons for...
2017-11-07
571 reads
I'm working on problems of enterprise data integration in the role of enterprise architect, but I am and have been...
2017-11-06 (first published: 2014-11-19)
6,372 reads
Defining the Problem
Imagine I have two different systems - say, a CRM and an ERP - on different SQL Servers. Both systems...
2017-11-05
474 reads
Update:
After all of this SMO stuff failed (changing the permission set to unsafe got around the security exception, but instead...
2011-06-15
1,484 reads
Relation Types
create type type_T(i int primary key clustered, j int check (j > 0)) -- relation type. Includes constraints!
create table T(type_T)
Relvar Assignment
This...
2011-06-15
956 reads
SSMSDeploy version 1.5 is ready. This one has a LOT of GUI tweaks. No database changes in this one, so...
2011-01-22
960 reads
Fixed a couple of issues and made some GUI tweaks. Please see the download page for the latest version, and...
2011-01-20
711 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