title: How to pass SSIS variables in ODBC SQLCommand expression?
body: <p>I'm trying to load incremental data from ODBC server to SQL server using common table expression.
  When running the query in the Dbeabver application, is executed correctly:</p>
  
  <pre><code>with test as
  (
      SELECT userid,sum(goldbalance)
      FROM Server.events_live
      where eventTimestamp&gt;=DATE '2016-01-01' + INTERVAL '-100 day'
      group by userid
      order by sum(goldbalance) desc)
  )
  select * from test
  </code></pre>
  
  <p>when running it from an sql command expression of the ODBC source, it fails due to wrong syntax. It looks as follow:</p>
  
  <pre><code>with test as
  (
      SELECT userid,sum(goldbalance)
      FROM deltadna.events_live
      where eventTimestamp&gt;=DATE '"+@[User::datestring]+"' + INTERVAL '-100 day'
      group by userid
      order by sum(goldbalance) desc)
  )
  select * from test"
  </code></pre>
  
  <p>the datestring variable is getting the server date and convert it to string in the format yyyy-mm-dd. I'm usually use this method to pull data from ADO.NET and it works properly.</p>
  
  <p>Is there any other way to pull incremental data from ODBC server using ssis variables?</p>