Is today a weekend or a weekday? A question from the very first SQL Bangalore User Group meeting, answered with the CHOOSE function in SQL Server 2012.
Display Datetime in a Specific Format: CONVERT and FORMAT
To display datetime in a specific format, use CONVERT with a style number or FORMAT with a pattern. This post tests both on a fixed value, shows the lowercase pattern mistake, measures how much slower FORMAT is, and explains why parsing text dates needs a style.
Storing UTC and Local Time Side by Side
Store UTC and local time consistently, preserve offsets, handle daylight saving changes, and filter timestamps with clear boundaries.
SQL SERVER – Function to Round Up Time to Nearest Minute Interval
A small T-SQL function that rounds a datetime up or down to the nearest minute interval you pass in, with the code and how to call it.
Merging Overlapping Date Ranges Into Continuous Periods
Use running end dates when merging overlapping ranges, choose boundary rules, and return continuous periods without losing nested intervals.
Audit Columns From Day One: CreatedAt, UpdatedAt and Who Changed It
Add audit columns with UTC timestamps and trusted change identities, maintain updates in procedures, and know when history is needed.
SARGable Date Filters: Stop Wrapping Columns in Functions
Write SARGable date filters as half-open ranges for years, months, days, and rolling windows, then compare plans and logical reads.







