DATETIME2FROMPARTS constructs a complete typed timestamp. Match fraction units to precision and preserve valid calendar components.
DATEADD Fractional Numbers: Truncate Before Addition
DATEADD fractional numbers are truncated, not rounded. Compare positive and negative day additions while preserving an explicitly typed date input.
Preventing Overlapping Date Ranges in a Table
Detect overlapping date ranges with joins and window queries, use half-open endpoints, and enforce the rule with a multirow trigger.
Adding Business Hours to a Timestamp in T-SQL
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.







