Using variables within a Data Flow ?

  • I attempted using the setting a variable as an expression and using it in my dataflow...All works well and the select statement compiles successfully inside an execute SQL task in the control flow.  But...when I try to use it as my source in my data flow, it errors:

    Error at Populate tRTLRevDstrbHstry [OLE DB  Source 1 [22096]]:An OLE DB error has occurred.  Error code: 0x80040E14. An OLE DB record is available. ..."Statement could not be prepared.". and goes on to talk about incorrect syntax near the keyword 'select'.". 

    When I remove the " + @[ACTYEAR] + " from my sql statement and change it with " + "2006" + " (which is really all the variable should be doing)...it succeeds.

    Anyone have any thoughts...I have been trying to figure this out for way to long and am getting slightly peeved...

    Thanks,

    Jennifer

  • Jennifer,

    That error comes from SQL Server so the expression has been evaluated just fine - its the resultant SQL statement that is erroring

    use this technique : http://blogs.conchango.com/jamiethomson/archive/2005/12/05/2462.aspx to debug the result of the expression.

    -Jamie

     

  • Hi,

    I have just noticed something, I have the same problem as you.

    When you create your Oledb Source, you can choose Access mode as SQL Command or SQL Command from Variable.

    I have to see how it works, because I haven't any variable in the list, but I will search.

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply