Comprehensive SQL Techniques: Pivot/Unpivot, String Replacement, Date Conversion, Division, NULL Handling, and Performance Tips
This article presents a collection of practical T‑SQL techniques—including row‑to‑column pivots, column‑to‑row unpivots, string replacement, date/time conversion, division with percentage formatting, NULL handling, counting methods, UNION ALL inserts, cache inspection, plan cache clearing, line‑break handling, TRUNCATE vs DELETE, system diagnostics, and execution‑time measurement—each illustrated with complete SQL code examples.