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
Gouache painting of three differently shaped tea cups on a bamboo tray beside a slate blue teapot, the small one vermilion

PRINT Date Format in SQL Server: PRINT Versus SELECT

August 23, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL String

The PRINT date format differs from the SELECT format, because PRINT converts the value to text first. This post tests PRINT with six date and time types, shows why joining text and a datetime fails with Msg 241, shows how the session language changes the month name, and gives the formats that stay the same everywhere.

Read More
Gouache painting of a small tower of round, square and triangular wooden blocks topped with a vermilion block

DATETIMEFROMPARTS Function: Build Dates From Parts

August 17, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

The DATETIMEFROMPARTS function builds a datetime value from seven numbers, with no string conversion and no language trap. This post tests how it rounds milliseconds, which parts raise an error, how it treats NULL, and how its relatives build dates, times and offsets.

Read More
An archery target with four nested rings in a field, one arrow in the red center and others in outer rings

Period-to-Date Totals: Today, Week, Month and Year in One Scan

April 27, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Reports, SQL Server

Calculate period-to-date totals with shared scan boundaries, Monday-based weeks, and older date arithmetic for SQL Server reports.

Read More
A layered sea cliff with one red fossil shell set in the middle band and a hand pointing to it

Price in Effect on a Date: Querying a Price History Table

March 5, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Index, SQL Joins, SQL Server

Query a price history table for the price effective on each order date, enforce unique starts, and compare APPLY lookups with range joins.

Read More
Two wooden metronomes side by side on a shelf, their pendulums swinging at different tempos

Scheduling Recurring Events: Every Second Tuesday in T-SQL

February 12, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Generate recurring events with stable weekday arithmetic, monthly ranking, and anchored fourteen-day rules instead of endless date rows.

Read More
Gouache painting of three hats on stands with the chosen one painted vermilion

Current Language of a SQL Server Session: How to Check It

February 8, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

To find the current language of a SQL Server session, read @@LANGUAGE or @@LANGID, or query sys.dm_exec_sessions. This post tests each one, switches the session to German and British, and shows how the language changes month names and how text turns into dates.

Read More
Parked cars along a curb seen from above with gaps between them, one wide enough for a car, one too short

Finding Free Time Slots in a Calendar With GENERATE_SERIES

January 12, 2019
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server, SQL Server 2022

Find free time slots with GENERATE_SERIES, exclude overlapping bookings, and merge busy intervals before calculating calendar gaps.

Read More
Previous 1 2 3 4 5 6 7 8 … 29 Next
  • Books
  • Testimonials
  • Privacy Policy

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