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
Muddy carrots scrubbed in a farmhouse sink, a colander of clean carrots on the drainboard and peelings in a bowl.

Cleaning Messy Data With T-SQL

April 8, 2012
Pinal Dave
SQL Tips and Tricks
Data Observability, ETL, SQL DateTime, SQL Server, SQL String

Cleaning messy data With T-SQL means trimming text, parsing dates safely, and preserving rejected source rows for correction and replay.

Read More
SQL SERVER - Various Leap Year Logics

SQL SERVER – Various Leap Year Logics

March 3, 2012
Pinal Dave
SQL Tips and Tricks
SQL DateTime

Dividing by 4 is not enough to find a leap year. Readers shared various leap year logics in the comments, and here are the best of them.

Read More
Gouache painting of a frog leaping across four lily pads on a pond, the last pad holding a red flower

Detect a Leap Year in T-SQL: Four Simple Ways

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

Detecting a Leap Year in T-SQL takes one rule or one date trick. This post tests four ways on SQL Server 2025: the calendar rule, EOMONTH, TRY_CONVERT and DATEDIFF. It shows that all four agree on 209 years, explains the century years that trip people up, and answers how leap years affect date math.

Read More
A long wooden fence across a meadow with one red post marking the boundary between two fields.

Date Functions Quiz: What Does DATEDIFF Count?

January 28, 2012
Pinal Dave
SQL Puzzle
SQL Datatype, SQL DateTime, SQL Function

This Date Functions Quiz asks what DATEDIFF returns for two dates one day apart, when the unit is year. The answer is 1, because DATEDIFF counts boundaries crossed. A tested script shows an age calculation that works, plus DATETRUNC and EOMONTH.

Read More
A stone harbor wall at low tide with a dark band of seaweed marking the high water line, a coil of rope on the quay.

Watermarks for Incremental Extracts

December 19, 2011
Pinal Dave
SQL Tips and Tricks
Change Data Capture, Data Warehousing, ETL, SQL DateTime, SQL Server

Watermarks for incremental extracts need clear boundaries, durable checkpoints, and a plan for late updates, deletes, and missed rows.

Read More
SQL SERVER - DATEDIFF - Accuracy of Various Dateparts

SQL SERVER – DATEDIFF – Accuracy of Various Dateparts

October 21, 2011
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts

Why does DATEDIFF say 1 minute between two times only 3 seconds apart? It is not a bug. Here is how DATEDIFF counts datepart boundaries.

Read More
SQL SERVER 2012 - DateTime Functions - DATEFROMPARTS() - DATETIMEFROMPARTS() - DATETIME2FROMPARTS()

SQL SERVER 2012 – DateTime Functions – DATEFROMPARTS() – DATETIMEFROMPARTS() – DATETIME2FROMPARTS()

September 19, 2011
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server, SQL Server 2012

SQL Server 2012 adds seven new datetime functions, such as DATEFROMPARTS, DATETIMEFROMPARTS and EOMONTH. A quick look at building dates from their parts.

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

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