Skip to content

Instantly share code, notes, and snippets.

Created January 22, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4610396193fe8c2c6874 to your computer and use it in GitHub Desktop.
Save anonymous/4610396193fe8c2c6874 to your computer and use it in GitHub Desktop.
MERGE etl.Change_Tracking_Version AS target
USING (
SELECT 'Emp' [Table_Name]
, ? [Version_ID] -- Get the change tracking version ID
) AS source
ON target.Table_Name = source.Table_Name
WHEN MATCHED
THEN UPDATE
SET target.Change_Tracking_Version = source.Version_ID
WHEN NOT MATCHED
THEN INSERT (Table_Name, Change_Tracking_Version)
VALUES (source.Table_Name, source.Version_ID);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment