DATETRUNC can give an ISO week its Monday boundary without changing session settings. I also keep the input date type explicit. A boundary calculation should reveal both its calendar rule and its return type.
STRING_AGG Order: Keep NULLs and Type Width Visible
STRING_AGG order belongs inside WITHIN GROUP. This example preserves duplicate labels, shows how NULL differs from empty text and casts to nvarchar(max) before aggregation.
HAVING Without GROUP BY: Filter One Implicit Aggregate Group
HAVING without GROUP BY filters the single implicit aggregate group produced by the query. I use that distinction when a summary should appear only if its aggregate condition passes. A false condition can remove the summary row entirely.
Compound Assignment Operators in T-SQL with Simple Examples
Compound Assignment Operators let T-SQL do a calculation and an assignment in one step, so SET @Stock -= 2 replaces SET @Stock = @Stock – 2. This post tests all eight operators on SQL Server 2025 with a small garden center inventory. It also shows integer division, NULL, string and flag examples, and where the shorthand does not help.
SQL SERVER – Create a Comma Delimited List Using SELECT Clause From Table Column
I received following question in email : How to create a comma delimited list using SELECT clause from table column?
SQL SERVER – Example of DISTINCT in Aggregate Functions
Does DISTINCT in Aggregate Functions make a difference? Yes. A quick AdventureWorks example compares SUM(DISTINCT ReorderPoint) with a plain SUM.
SQL SERVER – SQL SERVER – UDF – Get the Day of the Week Function Part 4
In Day of the Week Function Part 4, I answer why I write a UDF when DATENAME exists (I just like it) and show the one line DATENAME version.







