SSIS - Export from .csv to SQL
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.
Screenshot #1 shows the Data Flow Task configuration.
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.
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.
Screenshot #4 shows how the columns are mapped in the destination. Note that the new column is also mapped.
Hope that helps.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
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.
精彩评论