Using Parameters in CrossjoinSync

CrossjoinSync supports SQL template token substitution in dbo.Extract.ExtractSQL using {{Name}} placeholders.

Why this exists

  • Substitution is text-template based, not source-system command parameters.
  • This keeps parameter definitions consistent across providers.
  • SQL Server @localVariable syntax remains untouched because CrossjoinSync only replaces {{...}} tokens.

Token format

  • Allowed form: {{ParameterName}}
  • Name rule: starts with a letter, then letters/numbers/underscore.
  • Example token names: DateFrom, Widget, Status

Metadata model

  • dbo.ParameterValue: global values shared by all jobs/extracts.
  • dbo.Extract.ParameterListJson: per-extract allowlist of token names used by that extract.

ParameterListJson example:

["DateFrom", "Widget", "Status"]

Global parameter values example:

INSERT INTO dbo.ParameterValue (ParameterName, ParameterValue)
VALUES
  ('DateFrom', '2025-02-24'),
  ('Widget',   'Blue'),
  ('Status',   '1,2,5,8');

SQL usage example

SELECT *
FROM dbo.MySource
WHERE DateCol >= '{{DateFrom}}'
  AND WidgetCol = '{{Widget}}'
  AND [myDBStatus] IN ({{Status}});

With the values above, this renders as:

SELECT *
FROM dbo.MySource
WHERE DateCol >= '2025-02-24'
  AND WidgetCol = 'Blue'
  AND [myDBStatus] IN (1,2,5,8);

CLI override

Use --param Name=Value to override metadata values at runtime.

.\CrossjoinSync.exe extract --job DailySync --param DateFrom='2025-02-24' --param Widget='Blue'

Resolution and validation rules

  • Precedence: CLI --param value overrides metadata value.
  • Missing token value: extract fails immediately.
  • If ParameterListJson is populated, all tokens in SQL must appear in that list.
  • Logs include parameter names only; values are not logged.