This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
SQL SERVER - Find Weekend and Weekdays from Datetime in SQL Server 2012

SQL SERVER – Find Weekend and Weekdays from Datetime in SQL Server 2012

November 25, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server, SQL Server 2012

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.

Read More
Gouache painting of two shelves holding the same three jars in opposite orders, the short jar on the top shelf painted red

Display Datetime in a Specific Format: CONVERT and FORMAT

November 21, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL String

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.

Read More
Two identical cottages side by side, one in midday sun and one at night

Storing UTC and Local Time Side by Side

November 13, 2012
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL DateTime, SQL Function, SQL Server

Store UTC and local time consistently, preserve offsets, handle daylight saving changes, and filter timestamps with clear boundaries.

Read More
SQL SERVER - Function to Round Up Time to Nearest Minute Interval

SQL SERVER – Function to Round Up Time to Nearest Minute Interval

November 2, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

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.

Read More
A roofer laying overlapping wooden shingles: one long continuous run, a bare gap, then a short second run.

Merging Overlapping Date Ranges Into Continuous Periods

October 22, 2012
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL DateTime, SQL Scripts, SQL Server

Use running end dates when merging overlapping ranges, choose boundary rules, and return continuous periods without losing nested intervals.

Read More
A hand holding a steel punch over a new silver spoon on an anvil, ready to stamp its maker's mark.

Audit Columns From Day One: CreatedAt, UpdatedAt and Who Changed It

October 17, 2012
Pinal Dave
SQL Tips and Tricks
SQL Audit, SQL Constraint and Keys, SQL DateTime, SQL Server, SQL Trigger

Add audit columns with UTC timestamps and trusted change identities, maintain updates in procedures, and know when history is needed.

Read More
A gardener lifting white frost covers one by one along a vegetable row on a frosty morning.

SARGable Date Filters: Stop Wrapping Columns in Functions

October 5, 2012
Pinal Dave
SQL Performance
SQL DateTime, SQL Function, SQL Index, SQL Performance, SQL Server

Write SARGable date filters as half-open ranges for years, months, days, and rolling windows, then compare plans and logical reads.

Read More
Previous 1 … 13 14 15 16 17 18 19 … 29 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com