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 shop door at dusk with the shutter half down and a blank red board hanging beside it

Adding Business Hours to a Timestamp in T-SQL

October 17, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Add business hours through a stored work calendar, skip closed dates and nights, and calculate ticket deadlines without a minute loop.

Read More
Gouache painting: two identical thimble-sized brass measures stand on a white saucer

DATEADD Nanoseconds: Round to datetime2 Ticks

September 1, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server

DATEADD nanoseconds do not provide single-nanosecond storage. Test rounding thresholds with an explicit datetime2(7) input.

Read More
A round pizza cut from two slightly different starting points, leaving one narrow sliver between the cuts.

ISO Week Numbers vs DATEPART(week): Grouping Sales by Week

August 25, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Group By, SQL Server

Group sales by ISO week and ISO year, compare DATEPART week behavior, and avoid New Year errors caused by session settings.

Read More
Two long layered ice cores side by side, a gloved hand stretching a red thread across both at the same band.

Joining Two History Tables at a Point in Time With FOR SYSTEM_TIME AS OF

August 19, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Joins, SQL Server, Temporal Table

Use FOR SYSTEM_TIME AS OF to join temporal tables at one UTC instant, compare range forms, and index the history lookup correctly.

Read More
An unopened present with a red ribbon beside flat balloons and a party hat on a hall table

Calculating Age From a Date of Birth Correctly in T-SQL

August 7, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Use an explicit anniversary rule for calculating age in T-SQL, including February 29, years-months-days output and birthday lookups.

Read More
A wristwatch lying beside a torn-off paper calendar page on a wooden desk.

SQL SERVER – Get Time in Hour:Minute Format from a Datetime – Get Date Part Only from Datetime

August 6, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts, SQL Server

Get the time in Hour:Minute Format, or just the date, from a DATETIME with CONVERT styles 108 and 101, or with the TIME and DATE types in SQL Server 2008.

Read More
A SQL Server query in a window.

SQL SERVER – Find Last Date Time Updated for Any Table

May 9, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Scripts, SQL Table Operation

Want the last date time a table was updated without an UpdatedDate column? The sys.dm_db_index_usage_stats DMV shows it. A quick demo on AdventureWorks.

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

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