简体   繁体   中英

Migrate console C# to SSIS Script Task

I have a C# console app that reads Excel data and reformats it/cleans it up. Finally, app writes data to 2 different CSV files. This console app. has :

  1. Program.cs - contains Main method.
  2. Row.cs - properties that split each row of data into separate columns.
  3. Locations.cs - properties for working with locations (data is divided by regions/locations).
  4. LocationsBuilder.cs - contains main logic where data cleaning and transformation occurs.

I would like to migrate all of the C# code into an SSIS C# Script Task, not sure how to do this as Script Task code seems to only 1 use 1 file for all code.

I would like, if possible, to have all code in 1 script so it works in SSIS Script Task.

SSIS is a platform for ETL work. You can archive Excel to CSV format.

How to do it
1. Open Integration Services project / SQL Server Data Tools (SSDT)
2. Create a new SSIS package
3. Add data flow and add those 2 files as datasource 
4. Add control flow accordingly if you have any conditional logic in console applicaiton.
5. Add output destination as CSV ouput
6. That's it

You can keep your code as it is .

In the SSIS designer add a script task component, and copy all classes code inside the script (You can create multiple class inside one cs file or add new classes to the project) . And copy the main method code inside the main function in the script.

Or you can create a class library and use it inside the script task code.

Helpful links

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM