SQL Server Community Blogs

Voices of the SQL Server Community
Welcome to SQL Server Community Blogs Sign in | Join | Help
in Search

Jorg Klein's Microsoft Business Intelligence Blog [Macaw]

SSIS – Lookup Transformation is case sensitive

A while ago I figured out that the lookup transformation is case sensitive.
I used a lookup to find dimension table members in for my fact table records. This was done on a String business key like ‘AA12BB’. I attached a table for the error output and after running the package I found one record in this table.

This record had a business key like ‘Aa12BB’. I searched the dimension table for this missing record and it surprised me, it DID exist but with the following business key: ‘AA12BB’. It seemed the lookup transformation is case sensitive.

Next thing I tried was a T-SQL query in the management studio of SQL Server 2005. In the WHERE clause I referred to the business key: ‘Aa12BB’. The query returned the record with business key ‘AA12BB’. Conclusion: SQL Server is not case sensitive but the SSIS lookup component IS case sensitive… Interesting.


Solution:
After some research I found a few solutions for this interesting  feature of the lookup transformation. Before I explain these solutions you must know something about the inner working of the lookup component.

A lookup transformation uses full caching by default. This means that the first thing it does on execution, is loading all the lookup data in its cache. When this is done it works as expected, but with case sensitivity.

The solution is to set the CacheType property of the lookup transformation to Partial or None, the lookup comparisons will now be done by SQL Server and not by the SSIS lookup component.
Another solution is to format the data before you do the lookup. You can do this using the T-SQL LOWER() or UPPER() functions. These functions can be used in a query or for example in a derived column SSIS component.

 

Comments

 

SSIS Junkie said:

Jorg Klein has just written a useful blog entry about the SSIS Lookup component entitled "SSIS – Lookup

February 12, 2008 5:14 PM
 

Dave said:

Really interesting blog Jorg! I'll certainly keep this in mind!

February 12, 2008 8:55 PM
 

Jack Corbett said:

I also ran into this problem and after reading this post and others I was able to solve my problem.  I went to the advanced tab and Checked Enable Memeory Restriction and Modify SQL Statement.  Mapped the parameter and I was fine.  It may still be hitting the DB once per lookup, but at least the lookup is working.  I had tried using Upper in both my Lookup Query and Source Query and I still encountered the problem.  Another "solution" I first used in this situation was to use a Fuzzy Lookup with a min similarity of 1 and I got the matches I needed.

March 4, 2008 6:36 PM

This Blog

Syndication

News



Locations of visitors to this page
Powered by Community Server (Commercial Edition), by Telligent Systems