Avoiding Unexpected Results with DATEDIFF in Year Comparisons
Learn how to avoid unexpected results when using the DATEDIFF function to find the difference between two dates in years.
Learn how to avoid unexpected results when using the DATEDIFF function to find the difference between two dates in years.
Phil Factor argues that the ability to write simply and expressively is a much under-valued skill in IT, and explains the main traps to avoid.
Steve asks the question today of how you might measure downtime and the scope you are concerned about.
With SQL Server now supported on Linux, traditional SQL Server DBAs will need to learn how to work with Linux, and Linux administrators will need to learn how to work with SQL Server. Fortunately, there are several tools available to assist. In this article Prashanth Jayaram describes how to work with the DMV tool which treats queries as files.
Learn how you can execute a PowerShell script via the SSIS execute process task.
Today we have a guest editorial from Derik Hammer that reminds us that there isn't one solution that will fit all your solutions.
A myriad of laws regulate data retention and generally compete with each other. William Brewer provides an introduction to the principles, but gives good advice -- leave the details to the specialists.
Siddharth Mehta looks at how and why to use Sankey charts and how this can be done in Power BI Desktop.
This whitepaper explores the differences between the approaches, state based or migrations based, and how Redgate tools can help.
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