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 row of bean jars on a shelf, one jar with a single extra red bean on top

Leap Years in T-SQL: February 29 and Date Math

November 5, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Handle leap years in T-SQL with date functions, test February boundaries, and choose a clear anniversary rule for February 29 births.

Read More
Gouache painting: two identical long dough logs lie parallel on a floured counter, each sliced into rounds of equal width

DATE_BUCKET: Align 15-Minute Windows With an Origin

October 21, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Server, SQL Server 2022

DATE_BUCKET uses an origin to align reporting windows. Keep width, unit and origin explicit while checking timestamps around each boundary.

Read More
Gouache painting: in a stone laundry room, two zinc washtubs stand side by side on a low bench

datetime2 Precision: Rounding Can Cross Midnight

October 16, 2010
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL DateTime, SQL Scripts

datetime2 precision changes can round into the next second or date. Compare typed seven-digit values with millisecond and whole-second conversions.

Read More
Rich still life of five upright slate, sage and ivory books beside a leaning book and an oak bookend.

Inclusive End Dates: Why BETWEEN Misses the Last Day

July 25, 2010
Pinal Dave
SQL Tips and Tricks
SQL Coding Standards, SQL Datatype, SQL DateTime, SQL Server

Inclusive end dates describe whole calendar days, while BETWEEN compares the exact supplied endpoints. A date endpoint becomes midnight when compared with timestamp rows. A guarded disposable fixture makes the boundary conditions explicit.

Read More
SQL SERVER - Datetime Function TODATETIMEOFFSET Example

SQL SERVER – Datetime Function TODATETIMEOFFSET Example

July 16, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

A quick example of the datetime function TODATETIMEOFFSET in SQL Server, and how it differs from SWITCHOFFSET when offsets change.

Read More
SQL Server offset settings.

SQL SERVER – Datetime Function SWITCHOFFSET Example

July 15, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts

SWITCHOFFSET changes a datetimeoffset value from its stored time zone offset to a new one. Here is a quick example of how it works in SQL Server 2008.

Read More
Last date of a date table.

SQL SERVER – Difference Between DATETIME and DATETIME2 – WITH GETDATE

June 12, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts

I repeat my DATETIME and DATETIME2 test with GETDATE instead of SYSDATETIME. See how the distinct values in each column compare this time.

Read More
Previous 1 … 17 18 19 20 21 22 23 … 30 Next
  • Books
  • Testimonials
  • Privacy Policy

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