Query Exercise Answer: Generating Big TempDB Spills
In last week’s Query Exercise, I challenged you to play some code golf to generate big spills with tiny T-SQL.
2025-12-15
In last week’s Query Exercise, I challenged you to play some code golf to generate big spills with tiny T-SQL.
2025-12-15
Batched deletions are a common strategy in SQL Server to manage large datasets without overloading the system, but poorly tuned deletes can cause blocking, long-running transactions, and heavy log usage. Learn how to monitor and optimize these processes for smooth, efficient database performance.
2025-12-12
You are a developer using SQL Server for your applications, and you need to quickly setup a local development environment. How can you make sure the environment is OS agnostic, so it can run on any operating system? Let’s see how we can quickly create a local container to run SQL Server using the VSCode MSSQL Extension.
2025-12-10
Code refactoring is a common process when developing in procedural languages – and essential to developing high-quality code – yet somehow often gets overlooked in SQL.
2025-12-08
SQL Server 2025 and .NET 10 bring several new improvements to storing JSON natively in the database and querying it quickly.
2025-12-05
Security in cloud environments is both challenging and fascinating, particularly for Database-as-a-Service (DBaaS) offerings like Amazon RDS, GCP CloudSQL and Alibaba ApsaraDB RDS. The cloud vendor acts as the system administrator, managing the operating system, patching, and backups, while the user manages their data and databases.
2025-12-03
How can we build a random number generator using Marsaglia Polar method in SQL Server without the use of external tools?
2025-12-01
Troubleshoot query performance issues, identify anti-patterns in your code, and write efficient T-SQL queries with this guide for T-SQL developers
2025-11-28 (first published: 2024-02-29)
4,596 reads
Before SQL Server 2025, if you want to store JSON data in Microsoft SQL Server or Azure SQL DB, and you want fast queries, the easiest way is to:
2025-11-28
This tutorial will discuss using variables with SQL DECLARE along with various examples.
2025-11-26
I’ve been thinking a lot lately about what it actually takes to make an...
By Steve Jones
Redgate is a for-profit company. We look to make money by building and selling...
I’ve uploaded the slides for my Techorama session Microsoft Fabric for Dummies and my...
Comments posted to this topic are about the item Even When You Know What...
Comments posted to this topic are about the item The New Software Team
Comments posted to this topic are about the item Database Mail in SQL Server...
We create the following table and then insert some records in it:
create table t1 ( id int primary key, category char(1) not null, product varchar(50) ); insert into t1 values (1, 'A', 'Product 1'), (2, 'A', 'Product 2'), (3, 'A', 'Product 3'), (4, 'B', 'Product 4'), (5, 'B', 'Product 5');What happens if we execute the following query in both Sql Server and PostgreSQL?
select id,
category,
string_agg(product, ';')
over (partition by category order by id
rows between unbounded preceding and unbounded following) as stragg
from t1; See possible answers