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
Three wooden specimen trays hold leaves, seed pods and stones beside a magnifying glass.

PERCENTILE_DISC: Return an Observed Percentile Value

September 4, 2009
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Server

PERCENTILE_DISC selects from the supplied observations. Preserve duplicates and distinguish an observed threshold from an interpolated value.

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
Walnuts and cream beads rest in a slate-blue dish beside a magnifying glass, red thread spool and pale dish draped with sage-green cloth.

REGEXP_MATCHES: Read Matches and Capture Groups

August 28, 2009
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts

REGEXP_MATCHES returns full matches and captured groups. Read group values and positions, preserve duplicate letters, and check a no-match 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 red ceramic pitchers stand beside a blue pitcher on a sunlit workbench.

SUM DISTINCT: Equal Amounts Are Not Duplicate Rows

August 14, 2009
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL NULL, SQL Scripts, SQL Server

SUM DISTINCT totals different amounts without checking order identity. I’d establish the row grain first. Compare equal-priced orders, repeated copies and missing amounts.

Read More
Gouache painting: a round revolving spice carousel stands on a counter with seven jars around its rim, one lid vermilion to mark the first position

Modulo: Negative Values Keep the Dividend Sign

August 10, 2009
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

Modulo can return a negative remainder for a negative dividend. A second expression normalizes a positive-divisor bucket while keeping the original input and remainder visible.

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
Previous 1 … 55 56 57 58 59 60 61 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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