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 selected red cup marks one position within a continuous seasonal storage sequence.

SQL SERVER – Converting YYYYDDD Ordinal Date Codes Safely

March 2, 2015
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

This Julian date example uses an ordinal YYYYDDD code. I distinguish that business encoding from an astronomical Julian day number.

Read More
Gouache painting: a plain cream ribbon unrolled along a short wooden shelf, the ribbon stopping at the shelf edge where one vermilion pin marks the last spot

SQL SERVER – Quiz with DATEADD Function – SQL Puzzle

February 17, 2015
Pinal Dave
SQL Puzzle
SQL DateTime, SQL Function, SQL Scripts, SQL Server

The DATEADD function returns the last day of the month when the day does not exist, so one month after January 31 is February 28. This post keeps the quiz, runs every query on SQL Server 2025 and explains the month rule and the Msg 517 overflow with the real results.

Read More
An old wooden comb on a bathroom shelf with gaps where some of its teeth have broken off.

Gaps and Islands: Finding Missing Ranges in a Sequence

January 27, 2015
Pinal Dave
SQL Tips and Tricks
Ranking Functions, SQL DateTime, SQL Scripts, SQL Server

Solve gaps and islands with LEAD, ROW_NUMBER, and GENERATE_SERIES, then apply the same date patterns to missing days and login streaks.

Read More
Customer 1 has a total of 3 orders.

SQL SERVER – The Easy Functions of SQL Server – Notes from the Field #062

January 15, 2015
Pinal Dave
SQL Tips and Tricks
Notes from the Field, SQL DateTime

Kathi Kellenberger, the SQL author who got me hooked early in my career, explains some easy functions of SQL Server that many experts still do not know.

Read More
Collated nail strip with a defined end beside a loose nail heap

The Last Entered Row: Why a Table Needs an Ordering Column

December 27, 2014
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Identity, SQL Order By

A table has no last row until you define one. Here is how identity, event time and ties give different answers.

Read More
SQL SERVER - List the Name of the Months Between Date Ranges - Part 2

SQL SERVER – List the Name of the Months Between Date Ranges – Part 2

December 22, 2014
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, SQL Server

Part 2 on listing the names of the months between date ranges, with an improved script from readers Miladin Joksic and Peter Lalovsky that adds more details.

Read More
SQL Server Management Studio query window with SQL code.

SQL SERVER – List the Name of the Months Between Date Ranges – Correction

December 21, 2014
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function

Sanjay Monpara caught a small error in my script to list the name of the months between two dates: it skipped the first month. Here is his corrected script.

Read More
Previous 1 … 8 9 10 11 12 13 14 … 29 Next
  • Books
  • Testimonials
  • Privacy Policy

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