FOR XML PATH interprets column aliases as directions for the output’s attributes and element hierarchy. I use three aliases to shape two rows. The source columns stay ordinary relational values.
geometry Line Endpoints: Preserve the Described Direction
geometry line endpoints identify the first and last described points. Reversing the same path exchanges them, while a closed line starts and ends together.
LEFT Boundaries: Zero, Oversized Length and Missing Text
LEFT boundaries keep empty prefixes separate from missing values. Eight short Unicode cases expose zero, oversized and missing lengths. A separate invalid request shows why negative lengths need validation.
DATEFROMPARTS: Build Dates With Explicit Components
DATEFROMPARTS avoids ambiguous text assembly. Preserve year, month and day inputs while separating missing components from invalid calendar dates.
EXCEPT: Compare Distinct Sets Including NULL
EXCEPT returns distinct left-side rows absent on the right. Compare direction, duplicates and NULL equality using complete small result sets.
RANK vs DENSE_RANK: Keep Poll Ties at the Cutoff
RANK vs DENSE_RANK gives tied vote totals different cutoff behavior. Keep display ordering separate from the tie criterion and rank each poll independently.
geometry STEquals: Equal Shapes Can Have Different Text
geometry STEquals compares the represented point set, which can stay the same when its text representation changes. I separate that question from byte-for-byte text identity. Reversing a line does not necessarily change the places it occupies.







