The Import Column Transformation
What does the Import Column Transformation do?
The Import Column transformation is used to load binary data (photos, documents, media etc.) from the file system into a Data Flow. From the Data Flow it can then be loaded into a table, moved to a different location, modified – whatever you need to do. It is the reverse of the Export Column transformation, which pushes binary data out of a Data Flow and into the file system.
In my example I export product photo image thumbnails from the AdventureWorks database using the Export Column transformation, and then import them back in to a new table using the Import Column transformation.
Configuring the Import Column Transformation
The Import Column Transformation is another of those components that lacks a nice GUI, so all the configuration occurs in the advanced editor. In a similar manner to the Pivot, you need to create outputs that then have to be referenced by the inputs – though it is a bit simpler in this case. Just follow the steps below!
Firstly, select the input column that provides the file name and path of the binary data so the component can find the file it is going to import. This is simply a matter of selecting the appropriate column on the Input Columns tab, as below.
The second step is to create an output column to put the imported data into. Do this by switching to the Input and Output properties tab. Expand “Import Column Output”, select the Output Columns folder and click the “Add Column” button at the bottom of the form. Name the output (im my example below I called it “Imagefile”) and take note of the ID it is assigned (102 in my example).
You then have to expand “Import Column Input” and then the Input Columns folder. Select the input column that holds the file path of the binary data, and hidden down at the bottom of the properties list is the property “FileDataColumnID“. Update this property with the value you picked up from the Output Column that you just generated. This tells the output column where it is getting its binary data from.
This is everything you need to do to get the binary data into the Data Flow. Downstream from the Import Column transformation you manipulate the binary data using the Output Column you created within it.
Where should you use the Import Column Transformation?
This transformation would be useful for loading a database with images, documents of media files. I’ve not had call to use it yet so would be interested to hear of its practical applications.
If you are still struggling, try these additional resources:
- Importing Files Using SSIS from jwelch
- Loading Binary Files into SQL Server Using SSIS from SQLShare (registration required)
If you need specific help or advice, or have suggestions on the post, please leave a comment and I will do my best to help you.