The Import Column Transformation

Fig 1: The Import Column Transformation
Fig 1: The Import Column Transformation

In this post I will be covering the Import Column Transformation. The sample package can be found here for 2005 and guidelines on use are here.

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.

b
Fig 2: Selecting the Input Column

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).

b
Fig 3: Getting the ID of the new Output Column

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.

b
Fig 4: Mapping the Output Column to the Input Column

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.

MSDN Documentation for the Import Column Transformation can be found here for 2008 and here for 2005.

If you are still struggling, try these additional resources:

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.

Read More

The Export Column Transformation

b
Fig 1: The Export Column Transformation

In this post I will be covering the Export Column Transformation. The sample package can be foundĀ here for 2005 and guidelines on use are here.

What does it export, and to where?

It exports Binary Data – which means things like Images, Documents and other media – which have been stored in a relational database. It exports them out to the file system. In the example package, I demonstrate exporting image data from Adventureworks into a file folder.

b
Fig 2: Configuring the Export Column Transformation

There’s not much to configure – you need to decide which column(s) you are going to export to the file system, and which column you will use to specify the full file path and file name (you cannot just set a folder globally and use a file name only). MSDN shows the full range of outcomes if you set the Allow Append or Force Truncate flags, but essentially:

  • Allow Append – Will create a new file if none exists, otherwise it will add the data to the end of an existing file
  • Force Truncate – If a file exists, it will overwrite it

You also get the option to set a Byte Order Mark (or BOM), which as far as I can tell is a Unicode end of file marker, but if anyone can enlighten me, please do so.

The other thing to note is that this component can be the terminating point of a data flow – an output is available but not compulsory.

When would you use an Export Column?

The main use for this would be for extracting items stored in the database, or for placing them as files as you move them from point to point in or between data flows.

MSDN Documentation for the Export Column Transformation can be found here for 2008 and here for 2005.

Read More