Recursive CTE cycles need evidence of the repeated relationship. Use a visited path and separate cycle flags from deliberate depth boundaries.
Generating Backup Commands for Every Database With STRING_AGG
Use STRING_AGG for generating backup commands with copy-only backups, checksums, safe database names, and dated files for careful review.
Splitting a URL Into Host, Path and Query String in T-SQL
Practice splitting a URL into host, path, and query values with T-SQL string functions, SQL Server 2025 regex, and ordered parameter rows.
STRING_AGG Order: Keep NULLs and Type Width Visible
STRING_AGG order belongs inside WITHIN GROUP. This example preserves duplicate labels, shows how NULL differs from empty text and casts to nvarchar(max) before aggregation.
STRING_ESCAPE JSON Text: Escaping Is Not Serialization
STRING_ESCAPE JSON text is still text that belongs inside a JSON string. This example compares quotations, backslashes and a newline with complete FOR JSON PATH objects.
CHARINDEX Start Position: Find the Second Delimiter
CHARINDEX start position finds the next delimiter. Guard a missing first match, preserve NULL, and extract empty fields without negative lengths.
PATINDEX and CHARINDEX: Pattern or Literal Search
PATINDEX and CHARINDEX answer different questions. Compare wildcard patterns with literal searches, preserve NULL, and pin collation for digit ranges.







