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: two chains of equal length are pinned between the same pair of wooden posts

DATETIME2FROMPARTS: Match Fractions to Precision

December 26, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Server

DATETIME2FROMPARTS constructs a complete typed timestamp. Match fraction units to precision and preserve valid calendar components.

Read More
Gouache painting: beside the bag on a wooden board lies a second pretzel that is almost whole, missing only a small torn piece from one arm

DATEADD Fractional Numbers: Truncate Before Addition

December 13, 2009
Pinal Dave
SQL Tips and Tricks
SQL DateTime, SQL Function, SQL Scripts

DATEADD fractional numbers are truncated, not rounded. Compare positive and negative day additions while preserving an explicitly typed date input.

Read More
Beach towels laid edge to edge on the sand, seen from above, one red towel overlapping its neighbor

Preventing Overlapping Date Ranges in a Table

October 31, 2009
Pinal Dave
SQL Tips and Tricks
SQL Constraint and Keys, SQL DateTime, SQL Server, SQL Transactions, SQL Trigger

Detect overlapping date ranges with joins and window queries, use half-open endpoints, and enforce the rule with a multirow trigger.

Read More
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
Previous 1 … 19 20 21 22 23 24 25 … 30 Next
  • Books
  • Testimonials
  • Privacy Policy

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