Friday, 27 September 2013

Data Source SQL Command from Variable using default value instead of updated value

Data Source SQL Command from Variable using default value instead of
updated value

I have four dynamically assigned variables in my package. Each one is
populated using a query similar to this:
select 'SELECT * FROM SHARE_DM.MDM_ORG_CLASSIFICATIONS WHERE LAST_UPD_DATE
>= '''
+ (select convert(nvarchar(50), coalesce(max(last_upd_date),
cast('1/1/1900' as datetime)), 106) from MDM_ORG_CLASSIFICATIONS)
+ '''' sql
The default queries are defined like this:
SELECT * FROM SHARE_DM.MDM_ORG_CLASSIFICATIONS WHERE LAST_UPD_DATE >= '01
Jan 1900'
(I'm building the sql like this because I'm using Oracle data connections
and the parameter parsing doesn't work properly, where this technique has
worked before)
The output sql comes out like this:
SELECT * FROM SHARE_DM.MDM_ORG_CLASSIFICATIONS WHERE LAST_UPD_DATE >= '26
Sep 2013'
I have validated that my variables are being updated using message boxes
in script components. When I run the queries manually against Oracle, I
get very small result sets, as expected. However, when I run the package,
I get full result sets as if the default value of 1/1/1900 was being used
instead of the updated variable.
Each variable is set to EvaluateAsExpression False.
Comparing the operation in this package vs. a different package where I do
the same kind of operation, I'm not seeing any obvious differences -
except for one thing - in the other package I list each column in the
select statement, whereas in here I use select *.
Why isn't my OLE DB Source updating with the updated SQL from the variable?
Edit: Thinking maybe the select * was the issue, I updated one of them to
use explicit column names. No change.

No comments:

Post a Comment