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
Unmarked wooden spokes radiate from a brass hub toward blue, terracotta and pale stones.

ATN2: Keep the Quadrant When Calculating an Angle

March 8, 2010
Pinal Dave
SQL Tips and Tricks
Spatial Database, SQL Function, SQL Scripts, SQL Server

ATN2 uses two components to calculate an angle while retaining its quadrant. I keep the argument order and angle unit visible. Dividing one component by the other would lose useful information and introduce a zero-denominator case.

Read More
QUOTENAME object names illustrated by a wooden tray divided into two compartments, with slate-blue and sage blocks.

QUOTENAME Object Names: Quote Each SQL Server Name Part

February 26, 2010
Pinal Dave
SQL Tips and Tricks
Developer, SQL Function, SQL Server, SQL String

QUOTENAME object names separately to keep each part of a qualified SQL Server name intact. The function surrounds its entire input with identifier delimiters. A dot inside that input stays inside one quoted name. I keep the schema and object in separate variables.

Read More
Gouache painting: on a dyer's table, a slate-blue silk square partly overlaps a cream one, the shared corner showing a blended deeper tone while each square extends beyond it

geometry STOverlaps: Intersection Alone Is Not Enough

February 22, 2010
Pinal Dave
SQL Tips and Tricks
Spatial Database, SQL Function, SQL Scripts, SQL Server

geometry STOverlaps asks a narrower question than whether two shapes share any points. I test equal and contained regions alongside a partial overlap. Those intersecting cases do not all satisfy the method’s overlap definition.

Read More
A wooden toy train with its colored carriages uncoupled and laid in a straight line on the floor, engine at the front.

STRING_SPLIT and Its Ordinal Column

February 10, 2010
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Server, SQL Server 2022, SQL String

STRING_SPLIT and its ordinal column preserve token positions when you request the third argument and sort by ordinal in SQL Server.

Read More
Gouache painting: two shallow pastry boxes sit end to end on a bakery counter, each holding a single row of identical tarts

smalldatetime: Minute Rounding Can Change the Day

February 9, 2010
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

smalldatetime does more than hide seconds. These explicit conversions show minute rounding and a midnight carry, with complete original timestamps retained.

Read More
Gouache painting: seven wooden stakes stand in a straight row across a white lime line marked on grass, with an apple orchard plot on one side and a pear orchard plot on the other

ISO Week Numbers: Find the Matching ISO Week Year

February 7, 2010
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Function, SQL Scripts, SQL Server

ISO week numbers can belong to a different year from the calendar date. A Thursday-based calculation keeps the ISO year and week together across December and January.

Read More
SQL SERVER - Get Date of All Weekdays or Weekends of the Year

SQL SERVER – Get Date of All Weekdays or Weekends of the Year

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

Tejas Shah’s easy script to list the date of all weekdays or weekends of a year with a recursive CTE, first written to find every Sunday of 2010.

Read More
Previous 1 … 51 52 53 54 55 56 57 … 92 Next
  • Books
  • Testimonials
  • Privacy Policy

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