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 - 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
Table of five SQL Server time functions with their time zone, data type, fraction digits and the value each returned in one run. GETDATE and GETUTCDATE return datetime with 3 digits, and the others return 7 digits

GETUTCDATE and SYSUTCDATETIME: Which Current Time Function Returns What

August 16, 2011
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL DateTime, SQL Function, SQL Scripts

GETUTCDATE and SYSUTCDATETIME return the current time in UTC, while GETDATE and SYSDATETIME return the local time of the server. This post runs all four side by side and shows their data types and precision. It also shows why GETDATE values always end in 0, 3 or 7, and why a time stamp column should store UTC.

Read More
Gouache painting: three wooden shelves each hold the same three items: a large butternut squash for the year, a red apple for the month and a small blue plum for the day

CONVERT Date Styles: Use Explicit Numeric Formats

May 31, 2011
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server

CONVERT date styles make date displays explicit. Keep the typed value for date logic and agree the output format with the receiving interface.

Read More
An orchard gate in early spring with a red ribbon tied to the post

Fiscal Years That Do Not Start in January

January 1, 2011
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Reports, SQL Scripts, SQL Server

Compute fiscal years and quarters from an April start, build indexed date boundaries, and store a fiscal calendar for repeatable reports.

Read More
SQL SERVER - Information Related to DATETIME and DATETIME2

SQL SERVER – Information Related to DATETIME and DATETIME2

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

A reader comment explains the precision issue between DATETIME and DATETIME2: values lose precision when converted between types. Here is the workaround.

Read More
A garden kneeler with new side handles beside an old muddy folded sack, a red trowel on its pad

CURRENT_DATE, || and Other Small T-SQL Changes in SQL Server 2025

November 11, 2010
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server, SQL String

Use CURRENT_DATE, string concatenation, optional SUBSTRING length and bigint DATEADD in SQL Server 2025 with clear examples and checks.

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

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