Use Policy Management in SQL Server 2008 to enforce rules, not just list them. A short tutorial that blocks any stored procedure created without the usp prefix.
DATETRUNC: Use ISO Week Boundaries With Explicit Date Types
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.
When to Upgrade: RTM, First CU or Later
Decide When to Upgrade SQL Server by weighing new features, early defects, support needs, and evidence from your own workload.
SQL SERVER – Order of Conditions in WHERE Clause
Conditions in a WHERE clause don’t define a short-circuit evaluation sequence. I inspect actual behavior instead of relying on text order.
SQL SERVER – PIVOT and UNPIVOT Table Examples
If you PIVOT a table and then UNPIVOT it, do you get the original back? Not always. My PIVOT and UNPIVOT table examples show why aggregation loses data.







