goofyui
goofyui

Reputation: 3492

SSIS - Export from .csv to SQL

SQL 2008 : SSIS Package

Exporting .CSV file to SQL Table.

My SQL Table has an additional column : [SortCode]. Value of this Column is appended through a Variable.

Instead of writing an Update Query to update the SQL Rows, is there anyway for me to insert along with export !!

Upvotes: 0

Views: 1011

Answers (2)

user756519
user756519

Reputation:

You can create a new column using a Derived Column transformation by assigning a variable as the column value.

  1. Screenshot #1 shows the Data Flow Task configuration.

  2. Screenshot #2 shows how the flat file source is configured to read a CSV file. Note, only two columns are present in the CSV file.

  3. Screenshot #3 shows how a new column named SortCode is added using the Derived Column transformation. Note, the column is type casted as integer using (DT_I4). You can type cast it using different type cast operators.

  4. Screenshot #4 shows how the columns are mapped in the destination. Note that the new column is also mapped.

Hope that helps.

Screenshot #1:

1

Screenshot #2:

2

Screenshot #3:

3

Screenshot #4:

4

Upvotes: 2

Matt Donahue
Matt Donahue

Reputation: 76

You can use a derived column transformation in the data flow task. Just add a new column SortCode with a value that is mapped to your variable. Then in the destination task be sure to map that new column to the appropriate column in the table.

Upvotes: 1

Related Questions