title: Incremental copy cdc records with dynamic source in Azure ADF
body: <p>I have created a pipeline in Azure ADF to copy changed rows from 54 tables in our source db. I have followed the guide from <a href="https://docs.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-change-data-capture-feature-portal" rel="nofollow noreferrer">Azure</a>. And modified it to support dynamic tables.</p>
  <p>Im using a lookup to get all active CDC tables and then For each activity to execute the copy on every CDC table and it works good. But When I try to add the Trigger_Start_Time example code in the Azure guide I get this error:</p>
  <p>A database operation failed with the following error:</p>
  <blockquote>
  <p>'Incorrect syntax near '{'.'<br />
  Incorrect syntax near '{'.<br />
  , SqlErrorNumber=102,Class=15,State=1.</p>
  </blockquote>
  <p>Here is the example of the code I'm trying to execute:</p>
  <pre class="lang-sql prettyprint-override"><code>@concat('DECLARE @begin_time datetime, @end_time datetime, @from_lsn binary(10), @to_lsn binary(10) ; 
  SET @begin_time = ''',pipeline().parameters.TriggerStartTime,''';
  SET @end_time = ''',pipeline().parameters.TriggerEndTime,''';
  SET @from_lsn = sys.fn_cdc_map_time_to_lsn(''smallest greater than or equal'', @begin_time);
  SET @to_lsn = sys.fn_cdc_map_time_to_lsn(''largest less than or equal'', @end_time);
  SELECT count(1) changecount FROM cdc.fn_cdc_get_net_changes_dbo_@{item().Table_Name}(@from_lsn, @to_lsn, ''all'')')
  </code></pre>
  <p>I use the @{item().Table_Name} to set the table name. It works good if I hard code the table name like: &quot;Customer&quot;</p>
  <p>What am I missing, when I use the source parameter in the query?</p>