July 22, 2008 at 7:05 am
You cannot use a variable directly in the DataReader SQLCommand. You will need to use an expression on the data flow component. Just set the SQLCommand to your variable in the expression.
It has been my experience that you should use expressions and expression variables before using a script task. Going to a script task is typically a last resort for me. It adds complication for error handling, makes the interactive mode with visual studio less useful, and is generally harder to follow.
July 22, 2008 at 7:25 am
Thanks Michael!
I set the SQLCommand to my variable in the expression. It evaluated fine. However when I leave the expressions window, the sqlcommand property of the data flow task is blank. Is this ok, or do I need to add something here as well? Reason I ask is that I left it blank and now when I try to go into the datasource reader in the data flow I get the following warning:
The component has detected potential metadata corruption during validation.
Error at Data Flow Task [Source - Query [1]]: The SQL command has not been set correctly. Check SQLCommand property.
Do you want to edit this component?
July 22, 2008 at 7:41 am
Hard-code a T-SQL statement into the SQL Command of the Data Reader. Preferably one that will run very quickly (TOP 1 helps). The expression will over-ride this when the package runs, but you will need a SQL command at design time to set up the data flow. Just make sure they return the same meta-data.
Viewing 3 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply