SSIS Data Transform Design

I am trying to design a part of an SSIS package (Data Flow Task)  that uses an excel spreadsheet for its input and output.  I am good on the source/destination setups.

I want to take one column from the input spreadsheet (userid) and use that in a query that returns the corresponding employee id from a database, replacing the userid with employee id in the output spreadsheet.

Can you advise me on the appropriate data transformations to use for this?

I am using the BI studio for SQL Server 2005.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You will need to use a lookup transformation in between your source and destination To lookup for Employee Id that matches the User Id

In the Lookup
General Tab
Specify how to handle matching rows - Select Ignore Failure

Connection Tab
 you will need to select the Database and Then Select SQL Command from drop down and Write Down your SQL like SELECT UserId ,EmployeeID FROM TableName

Map the UserId of the Source To Destination and Check the box beside EmployeeId

And Lastly Map Matching output from Lookup to Destination

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Safest way is to import the Excel sheet in to a table (temp table in sorts) and do queries from it.  Reasoning is you can clean the data during import and dictate the data type of the data you're importing (can be some ambiguity when dealing with Excel columns).

Reza RadConsultant, TrainerCommented:
please let us know if you have problem in implementing vdr1620 method on Lookup  Transformation ,or if you want to use carsRST method about temp table.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

harveystephenbAuthor Commented:
I haven't been able to get the Lookup transformation to join with the User_Name input.  I get "Error at Data Flow Task [Lookup[1225] input column "User_Name" has data_type which cannot be joined."

I tried inserting a data conversion transformation in between the Excel source and the Lookup data transformation changed the output column type from DT_WSTR to DT_STR, DT_Text, and DT_NText.

Still same error message.

Was I destined to fail by following this advice?
Reza RadConsultant, TrainerCommented:
problem is: DT_NTEXT can not be used for lookup,
harveystephenbAuthor Commented:
Should not DT_STR work?
the Lookup approach was an appropriate solution to your problem..and it would solve the issue that you have posted..  

DT_STR should work.. In order to convert DT_NText to should convert it to text and then str as below


Make sure that both the Source and Lookup column that you are trying to join have same data type

Reza RadConsultant, TrainerCommented:
DT_STR should work correctly.
do you receive any error? paste exact error message here
harveystephenbAuthor Commented:
The column data type coming out of the excel file shows at DT_WSTR with length 255.  I tried using a data conversion transformation to change it to DT_STR with length 50.

The join column from the table I am querying from in my Lookup transformation is nvarchar(50).
I tried casting it in my query to varchar(50) hoping for a match.

I am not sure what you mean by

In order to convert DT_NText to should convert it to text and then str as below


Where do  I plug in such syntax?

harveystephenbAuthor Commented:
Exact error message is:

 I get "Error at Data Flow Task [Lookup[1225] input column "User_Name" has data_type which cannot be joined."
Ok..I thought that you were trying to map a Ntext column to Str i suggested to use the exp in derived column..never mind

Since,its a WSTR to don't need change the column datatypes ...If you did that's fine too.. Some times it just happens that though you change the datatype the metadata of the column does not change try to remove the column and add it again ..That might solve (if you are mapping right data types)

Also, use advanced editor and check the datatypes of th input and output columns..see the output columns have the data type that you have converted them to be... ( Rt click on transformation and Select Advanced editor)  
Reza RadConsultant, TrainerCommented:
also you can change datatype of input columns, in sources, right click , advanced editor, output column, change data type.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.