SSIS Wizard: Import flat file, add 2 columns and insert default values into the columns

Hi All,

I have a flat file in Excel which I want to import through the SSIS Wizard or create my own SSIS package from scratch.

I need to transform this file in two ways into a table:

1) Add a column called 'Region' to the right of a column called 'Code' and based on the type of code in that row add the specific region. For example, if code is '2452' then add region 'North West'.

2) Add a column called 'Type' to the right of a column called 'Amount' and if the amount for that row is a negative figure then add 'Liability' for type and if that amount for that row is a positive figure then add 'Asset' for type.

I'm even thinking about the logistics. Is it better to import the flat file and then perform the transformation in the table or perform it during the import?

Advice appreciated.

Thanks,

OS
onesegunAsked:
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.

onesegunAuthor Commented:
Ok I think I've figured out how to add the extra columns using derived columns in this tutorial. http://www.youtube.com/watch?v=yiuiIY9DVhM

I'm going to give it a whirl.

This might possibly be the solution I was looking for (unless anyone has any better ideas)

Thanks,

OS
0

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
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
In your Data Flow Task there will be an Excel Source for your file, and a <whatever> destination for your target.

In the middle add a Derived Column task, creating the two new columns and populating it based on values in other columns in the source.

>Is it better to import the flat file and then perform the transformation in the table or perform it during the import?
Your call, whether you use the above SSIS-Derived Column method, or write T-SQL that does it and then call it from the SSIS package after the data flow task is complete.
0
onesegunAuthor Commented:
Straightforward method other creating another column during SSIS based on conditions of another column find via a simple online Youtube tutorial
0
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 2008

From novice to tech pro — start learning today.