liveBook · Manning

Parameterized date

As explained in 100 SQL Server Mistakes and How to Avoid Them

A parameterized date is a process date supplied as an input value rather than embedded as a fixed expression in code.

A parameterized date supplies the processing date as an input instead of embedding a changing expression in ETL code. Hardcoding WHERE DataDate = GETDATE() may seem convenient, but a run scheduled at 10 p.m. cannot be rerun reliably for its intended date without code changes. section 12.5

Mistake: using the clock as the processing date

An ETL process fails partway through, then is manually restarted. A GETDATE()-based filter now selects a different time window, while repeated INSERT statements can create duplicate business keys across multiple transactions. Pass the intended processing date explicitly, then merge the resulting data. section 12.5

Use parameterized dates with these safeguards:

  • Keep original source data available through retention, configurable APIs, or caching. section 12.5
  • Merge into target tables rather than relying only on INSERT statements. section 12.5

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Defines the rerun requirement and contrasts explicit dates with GETDATE(), but stops short of implementation syntax.
Examples
Uses a 10 p.m. schedule, a GETDATE() filter, a failed multi-transaction run, and duplicate business keys.
What it assumes
Assumes basic ETL scheduling and table-loading knowledge while defining why source retention and merging matter for reruns.
What you can do after
Build it from scratch as an ETL input so reruns require no code changes and target data can be merged safely.
How it connects
Connects rerunnable ETL with eventual convergence, source data retention, caching, merge operations, and transactions.

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.