sql server - Lookup component fails to match empty strings when full cache is used -



sql server - Lookup component fails to match empty strings when full cache is used -

i have lookup component lookup table retusn varchar(4) column 3 possible values: "t", "r" or "" (empty string).

i'm using ole db connection lookup table, , have tried direct access table, specifying query rtrim() on column, sure string empty , not "blank string of length".

if set cache mode "partial cache" works fine (either direct reading of table, or using trimming query), , empty strings correctly matched of input table correctly matched lookup table.

however, if alter cache mode "full cache", none of empty strings matched @ all.

i've checked info type, dt_str, , lenght, 4, same in lookup table , input table.

is there explains behaviour? can modified?

note: not documented problem null values. it's empty strings.

somewhere, have trailing spaces, either in source or lookup.

consider next source query.

select d.sourcecolumn , d.description ( values (cast('t' varchar(4)), 't') , (cast('r' varchar(4)), 'r') , (cast('' varchar(4)), 'empty string') , (cast(' ' varchar(4)), 'blanks') , (null, 'null') ) d (sourcecolumn, description);

for lookup, restricted above query t, r , empty string rows.

you can see 5 source rows, t, r , empty string matched , went match output path. used null or explicitly used spaces, did not create match.

if alter lookup mode total cache partial, null continues not match while explicit spaces does match.

wut?

in total cache mode, lookup transformation executes source query , keeps info locally on machine ssis executing on. lookup going exact match using .net equality rules. in case, '' not match ' '.

however, when alter our cache mode none or partial, no longer relying on .net matching rules , instead, we'll utilize source database's matching rules. in tsql, '' will match ' '

to create total cache mode work expected, need apply rtrim in source and/or lookup transformation. if convinced rtrim isn't working source, add together derived column transformation , apply rtrim there find it's improve abuse database instead of ssis.

biml

biml, business intelligence markup language, describes platform business intelligence. bids helper, free add together on visual studio/bids/ssdt we're going utilize transform biml file below ssis package.

the next biml generate

<biml xmlns="http://schemas.varigence.com/biml.xsd"> <connections> <oledbconnection name="cm_ole" connectionstring="data source=localhost\dev2012;initial catalog=tempdb;provider=sqlncli11.0;integrated security=sspi;" /> </connections> <packages> <package constraintmode="linear" name="so_26719974"> <tasks> <dataflow name="dft demo"> <transformations> <oledbsource connectionname="cm_ole" name="olesrc source"> <directinput> select d.sourcecolumn , d.description ( values (cast('t' varchar(4)), 't') , (cast('r' varchar(4)), 'r') , (cast('' varchar(4)), 'empty string') , (cast(' ' varchar(4)), 'blanks') , (null, 'null') ) d (sourcecolumn, description); </directinput> </oledbsource> <lookup name="lkp poc" oledbconnectionname="cm_ole" nomatchbehavior="redirectrowstonomatchoutput" > <directinput> select d.sourcecolumn ( values (cast('t' varchar(4))) , (cast('r' varchar(4))) , (cast('' varchar(4))) ) d (sourcecolumn); </directinput> <inputs> <column sourcecolumn="sourcecolumn" targetcolumn="sourcecolumn"></column> </inputs> </lookup> <derivedcolumns name="der default catcher" /> <derivedcolumns name="der nomatch catcher"> <inputpath outputpathname="lkp poc.nomatch" /> </derivedcolumns> </transformations> </dataflow> </tasks> </package> </packages> </biml>

sql-server ssis etl ssis-2012

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -