geometry STPointN selects a point from an instance. The example keeps its one-based position visible and returns NULL when the requested position exceeds the line point count.
T-SQL Features Added in Recent Versions
T-SQL features added in recent SQL Server versions shorten common date, comparison, string, and JSON patterns when deployed deliberately.
SQL SERVER – Question to You – When to use Function and When to use Stored Procedure
Deciding when to use functions or stored procedures depends on the caller and required work. I want examples behind that choice.
REGEXP_REPLACE Text Cleanup: Replacing Tags Is Not Parsing HTML
REGEXP_REPLACE can remove controlled tag-like text, but that is not the same as parsing HTML. Test quoted brackets, surviving script text and word boundaries before deciding whether the replacement fits the input.
CONVERT Date Styles: Use Explicit Numeric Formats
CONVERT date styles make date displays explicit. Keep the typed value for date logic and agree the output format with the receiving interface.
OPENJSON Default Schema: Read Its Type Codes
OPENJSON default schema exposes key, value and type. Compare all six type codes, retain JSON null, and distinguish scalar text from nested fragments.
geometry STAsText: Z and M Values Need a Different Export
geometry STAsText returns spatial text without the Z and M values carried by an instance. I compare it with ToString using two points. Identical XY text can hide a difference in the original payload.







