title: SSIS The parameterized sql statement yields metadata which does not match the main SQL statement
body: <p>I'm getting the above error when trying to execute a custom lookup.  What I'm trying to do is lookup the minimum promotional price between date ranges.  The SQL executes fine in SSMS</p>
  
  <pre><code>SELECT  refTable.PRICE
  FROM    ( SELECT    MIN(PRICE) AS PRICE ,
                      NAME ,
                      ITEMRELATION ,
                      FROMDATE ,
                      TODATE
            FROM      [dbo].[AllCustPrices]
            GROUP BY  NAME ,
                      ITEMRELATION ,
                      FROMDATE ,
                      TODATE
          ) [refTable]
  WHERE   [refTable].[NAME] = ?
          AND [refTable].[ITEMRELATION] = ?
          AND ? BETWEEN [refTable].[FROMDATE]
                                        AND     [refTable].[TODATE]
  </code></pre>
  
  <p>but errors in SSIS?</p>
  
  <p><img src="https://i.stack.imgur.com/yQ5DI.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/QkkOj.png" alt="enter image description here"></p>