开发者

SSIS - Export from .csv to SQL

开发者 https://www.devze.com 2023-03-15 11:24 出处:网络
SQL 2008 : SSIS Package 开发者_Go百科Exporting .CSV file to SQL Table. My SQL Table has an additional column : [SortCode]. Value of this Column is appended through a Variable.

SQL 2008 : SSIS Package

开发者_Go百科

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 !!


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:

SSIS - Export from .csv to SQL

Screenshot #2:

SSIS - Export from .csv to SQL

Screenshot #3:

SSIS - Export from .csv to SQL

Screenshot #4:

SSIS - Export from .csv to SQL


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号