Search code examples
sql-serverssisetlflat-file

Add a column with specific text that is not contained in my flat file before being imported into SQL?


Lets say I have a Flat File with 3 columns (EXAMPLE PIPE SEPARATED) This is Flat File

Name   | LastName | BirthDay
Arthur |   Tower  | 10-10-1990

Now in SSIS how can I add Columns but I want the column to have a specific text/number (value) on which I will specify the source since i will be importing data from different systems to the same SQL Table

Example of how I want to see once imported in SQL

Name    | LastName  |  BirthDay  | FileFrom
Arthur  |   Tower   | 10-10-1990 |  Facebook
Karen   |   Salty   | 12-19-1987 |  Twitter

Solution

  • Well this is what I did,

    I added a Derived Column and on EXPRESSION I SET the following: REPLACENULL("TheValueINeeded","NULL")

    To replace nulls with the value I wanted, I am not sure if this is the correct way to do it but it worked.

    Now my imported data to SQL it's all the flat file info and in the last ADDED COLUMN I'm sending "TheValueINeeded".

    Thanks for the help Stackers.