A derived table, CTE and view can express the same grouped result while offering different scopes. Compare complete outputs with duplicates and NULLs, then choose a statement-local expression or a saved definition for the task.
FIRST_VALUE IGNORE NULLS: Find the First Available Value
FIRST_VALUE IGNORE NULLS selects the first present value through the current row. Preserve source rows and distinguish first from latest.
Preventing Overlapping Date Ranges in a Table
Detect overlapping date ranges with joins and window queries, use half-open endpoints, and enforce the rule with a multirow trigger.
geometry STCentroid: The Geometric Center Is Not an Interior Promise
geometry STCentroid returns a polygon’s geometric center, but that point is not a promise of interior placement. I keep the center calculation separate from an interior test. A holed region makes that distinction visible.
CDC Cleanup and Capture Jobs: Keeping the Log and Change Tables Small
Keep CDC cleanup and capture jobs healthy by checking log reuse, job settings, retention, polling, and a stopped-job alert.
SQL SERVER – How to Enable Index – How to Disable Index – Incorrect syntax near ‘ENABLE’
ALTER INDEX with ENABLE fails with Incorrect syntax near ‘ENABLE’. To enable index after you disable it for a bulk load, you rebuild it instead.
Environment Settings in SSIS Projects
SSIS projects can deploy one package across environments by using project parameters, SSISDB variables, and tested references.







