A weighted average preserves each group’s contribution. I compare unequal groups before combining their means. Group totals and populated-value counts reconstruct the underlying average without treating missing readings as zero.
SQL SERVER – 2008 – SQL Server Start Time
SQL Server 2008 records when it started in sys.dm_os_sys_info. One SELECT of sqlserver_start_time gives you the SQL Server start time. It does not work on 2005.
SQL SERVER – Introduction to SERVERPROPERTY and example
SERVERPROPERTY is a handy system function that returns server values like collation, edition and instance name. My script lists every property in one result.
SQL SERVER – 2008 – Introduction to Policy Management – Enforcing Rules on SQL Server
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.







