Add business hours through a stored work calendar, skip closed dates and nights, and calculate ticket deadlines without a minute loop.
DATEADD Nanoseconds: Round to datetime2 Ticks
DATEADD nanoseconds do not provide single-nanosecond storage. Test rounding thresholds with an explicit datetime2(7) input.
ISO Week Numbers vs DATEPART(week): Grouping Sales by Week
Group sales by ISO week and ISO year, compare DATEPART week behavior, and avoid New Year errors caused by session settings.
Joining Two History Tables at a Point in Time With FOR SYSTEM_TIME AS OF
Use FOR SYSTEM_TIME AS OF to join temporal tables at one UTC instant, compare range forms, and index the history lookup correctly.
Calculating Age From a Date of Birth Correctly in T-SQL
Use an explicit anniversary rule for calculating age in T-SQL, including February 29, years-months-days output and birthday lookups.
SQL SERVER – Get Time in Hour:Minute Format from a Datetime – Get Date Part Only from Datetime
Get the time in Hour:Minute Format, or just the date, from a DATETIME with CONVERT styles 108 and 101, or with the TIME and DATE types in SQL Server 2008.
SQL SERVER – Find Last Date Time Updated for Any Table
Want the last date time a table was updated without an UpdatedDate column? The sys.dm_db_index_usage_stats DMV shows it. A quick demo on AdventureWorks.







