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: on a kitchen counter one moka pot stands fully assembled from its three parts: base, funnel basket and top chamber

DATEFROMPARTS: Build Dates With Explicit Components

April 5, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server

DATEFROMPARTS avoids ambiguous text assembly. Preserve year, month and day inputs while separating missing components from invalid calendar dates.

Read More
An open brass cash drawer holds undisturbed coin stacks as a shop shutter is lowered.

End-of-Day Balances From a Transaction Table

March 11, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, Temp Table

A transaction table stores movements, not balances. Collapse each day, run a total, fill the quiet days and dodge the midnight trap.

Read More
SQL Server 'WAITFOR' execution context in Visual Studio.

SQL SERVER – Time Delay While Running T-SQL Query – WAITFOR Introduction

January 3, 2009
Pinal Dave
SQL Tips and Tricks
Best Practices, SQL DateTime, SQL Scripts, SQL Utility

WAITFOR makes a T-SQL batch pause for a set time, or until a clock time, before the next statement runs. I show both uses with small examples.

Read More
A weather vane with a red rooster turning with the wind on a barn roof

Rolling Date Ranges Forward Without Hard-Coded Years

January 1, 2009
Pinal Dave
SQL Tips and Tricks
Execution Plan, SQL DateTime, SQL Server, SQL Stored Procedure

Replace hard-coded years with indexed date ranges for current periods, full months, year-to-date comparisons, and any requested year.

Read More
Four unequal woven cloth strips form one continuous sequence across an oak bench in a sunlit stone workshop.

Running Start Times: Build an Agenda With SQL

November 25, 2008
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Order By, SQL Scripts

Running start times depend on the durations that precede each activity. Use ordered window sums while retaining full dates and explicit end boundaries.

Read More
Execution time statistics.

SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice – Part 2

October 18, 2008
Pinal Dave
SQL Performance
Best Practices, SQL DateTime, SQL Function, SQL Scripts

Which way to select only date part from DATETIME is faster? After more tests on large tables, I now suggest the DATEADD and DATEDIFF method over CONVERT.

Read More
Gouache painting: on a straight farm lane two gateposts stand apart

SWITCHOFFSET Versus TODATETIMEOFFSET: Two Offset Operations

October 7, 2008
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server

SWITCHOFFSET versus TODATETIMEOFFSET depends on the input contract. Preserve a known instant or attach an offset to a genuinely local clock.

Read More
Previous 1 … 20 21 22 23 24 25 26 … 29 Next
  • Books
  • Testimonials
  • Privacy Policy

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