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
A lazy susan with seven colored bowls, including a red one, around a ring.

Weekday Logic That Works Under Any DATEFIRST Setting

April 27, 2013
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Make weekday logic independent of DATEFIRST with a normalized offset or a known Monday, then test every date in a full year.

Read More
A table of FORMAT strings for 2024-08-12: MMMM gives August, MMM gives Aug, MM gives 08. Beside it, for 9:22:38 pm, MM gives 10, mm gives 22, HH gives 21, hh gives 09 and ss gives 38

Custom Date Format Strings in SQL Server: MM Is Not mm

February 28, 2013
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Custom date format strings tell FORMAT exactly which parts of a date to show. This post compares CONVERT styles with FORMAT, lists the standard and custom letters, and shows the traps: MM against mm, YYYY against yyyy, month names that sort wrong, and a culture that changes with the session. Every result comes from SQL Server 2025.

Read More
A stone sundial in a walled garden at midday with a crisp shadow, a trowel and a basket of cut flowers on its plinth.

Designing a Date Dimension

January 20, 2013
Pinal Dave
SQL Tips and Tricks
Business Intelligence, Data Warehousing, SQL DateTime, SQL Server

A date dimension makes reporting calendars explicit with fiscal periods, holidays, weekdays, and a repeatable SQL Server build script.

Read More
Getdate with currenttimestamp comparison.

SQL SERVER – Difference Between CURRENT_TIMESTAMP and GETDATE() – CURRENT_TIMESTAMP Equivalent in SQL Server

December 20, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime

Is there a difference between CURRENT_TIMESTAMP and GETDATE()? No. One is ANSI SQL and the other is the T-SQL version, and both return the same value.

Read More
Gouache painting of a wooden ticket inspection station checking outer shape and matching slots in two separate stages.

Validate a Date With Regex in SQL Server 2025: Shape Is Not Enough

December 12, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server, SQL String

To validate a date with regex in SQL Server 2025, pair REGEXP_LIKE with TRY_CONVERT. The tests here show impossible dates that pass a strict pattern, spellings that convert but break the format, and how to enforce both checks with a constraint.

Read More
A wall key rack with five keys, two empty hooks and one hook tied with a red ribbon

A Calendar Table With Holidays for Date Math

December 6, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, SQL Server

Build a calendar table with weekdays, fiscal months, and American holiday flags, then count working days and find useful date boundaries.

Read More
SQL SERVER - Fix Error: Microsoft OLE DB Provider for SQL Server error '80040e07' or Microsoft SQL Native Client error '80040e07'

SQL SERVER – Fix Error: Microsoft OLE DB Provider for SQL Server error ‘80040e07’ or Microsoft SQL Native Client error ‘80040e07’

December 3, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Error Messages

Error 80040e07, syntax error converting datetime from character string, usually means a bad date value. In one case a reader had simply misspelled September.

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

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